| View previous topic :: View next topic |
| Author |
Message |
Eraser Grandmaster Cheater
Reputation: 0
Joined: 23 Jul 2008 Posts: 504 Location: http://www.youtube.com/PCtrainers
|
Posted: Thu Jul 09, 2009 2:02 pm Post subject: Put a specific symbol after each word. |
|
|
I have a very big list of words, they are in this format:
tt8t8tttt
hhhjhj5jjj
hjhj58h8h8h
ghgf8gf8hhhh
ghgfh8gh8g8h
hhjg7jhgj87
hjh8j8ghj8h
ijuu4y4y4yyy
ggg4g4g4rtrtre
ghg8hgh8jj
fgfgdfgfd8g
jkhj7k8hj7k
jjj8hujk7hk
uuuu8uuu9ttt
vvvdv8dvvv
uuuu8uuu9ttt
KKKK9HJ9HH
hyh8h8hg4h
jjjimondaroks
kkkk9kkkk9uuu
ghghghg8
i need it to be in this format: tt8t8tttt;hhhjhj5jjj;hjhj58h8h8h;
any idea how to do this automatically?
|
|
| Back to top |
|
 |
NothingToShow Grandmaster Cheater Supreme
Reputation: 0
Joined: 11 Jul 2007 Posts: 1579
|
Posted: Thu Jul 09, 2009 2:07 pm Post subject: |
|
|
It can be done by making a program read all files into an array or list, then output them again by doing something like this:
for each line in file.txt do
String output = output + current line + ";"
That's a very basic method, but can be used.
I can try to make something in Python.
Here you go:
| Code: | file = open ("fil.txt","r") //edit this to your file name. (fil.txt)
output = ""
for line in file.readlines():
line = line.replace('\n', '') //replaces new lines
output = output + line + ";" //just edit the ";" part to whatever symbol you want
print output |
It does what you want it to.
It gives the output as:
line1;line2;line3;
|
|
| Back to top |
|
 |
FullyAwesome I post too much
Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
|
| Back to top |
|
 |
LolSalad Grandmaster Cheater
Reputation: 1
Joined: 26 Aug 2007 Posts: 988 Location: Australia
|
Posted: Thu Jul 09, 2009 6:27 pm Post subject: |
|
|
You can put this in your address bar and do it from your browser.
| Code: | | javascript:document.innerHTML='<textarea rows="10" cols="20" id="in">Enter text here.</textarea><br/><input type="text" value="Enter delimiter here." id="delim"/><br/><input type="submit" value="Convert" onclick="javascript:var d=document.getElementById(\'delim\').value;alert(document.getElementById(\'in\').value.split(\'\\n\').join(d)+d)"/>'; |
_________________
|
|
| Back to top |
|
 |
Eraser Grandmaster Cheater
Reputation: 0
Joined: 23 Jul 2008 Posts: 504 Location: http://www.youtube.com/PCtrainers
|
Posted: Fri Jul 10, 2009 1:05 am Post subject: |
|
|
Thank you, this one worked very good.
And for python.. i didn't have it so i couldn't paste the code
|
|
| Back to top |
|
 |
Trucido Moderator
Reputation: 6
Joined: 08 Sep 2007 Posts: 2792
|
Posted: Fri Jul 10, 2009 2:43 am Post subject: |
|
|
Seems to be answered.
_________________
I'm out. |
|
| Back to top |
|
 |
|