Games (2013)
Games (2014)
Games (2015)
References
External links
Category:Video games featuring female protagonists
Category:NEC PC-6001 games
Category:Japan-exclusive video games
Category:NEC PC-6001-only games
Category:Romero games
Category:Shoot 'em ups
Category:Sengoku video games
Category:Video games developed in Japan
Category:Western (genre) video gamesQ:
Add a character to the first character of each line
I want to add a character to the first character of each line in my text file. I tried using sed, but was not successful.
Original text
1
2
3
4
5
Desired output
1a
2a
3a
4a
5a
A:
I don't know how to use sed, but a python script should be easy to write:
#!/usr/bin/env python3
import sys
with open(sys.argv[1], 'r') as f:
for line in f:
line = line.strip()
line = line.replace(' ', 'a')
sys.stdout.write(line)
or if you don't want to change your existing data:
#!/usr/bin/env python3
import sys
with open(sys.argv[1], 'r') as f:
for line in f:
line = line.strip()
line = line.replace(' ', 'a')
sys.stdout.write(line)
Run it like:
$ sed -f python.sed data.txt
1a
2a
3a
4a
5a
Q:
how to know which operation is taking most time
I am running a python script and want to know the total operation time. My script is really long and I can't simply say print total time of the whole script. Instead of that I want to know how much time is taken by each line of the script. The code I tried is as follows:
from __ be359ba680
Related links:
Comments