Created
January 29, 2016 07:13
-
-
Save sudevschiz/ef0d3647f9cdc1cd7ae6 to your computer and use it in GitHub Desktop.
Script to remove some unwanted character from a string. Basic string manipulation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
out_file = open("out_file.txt","w") | |
with open('formulas.txt','r') as fil: | |
for lin in fil: | |
#Here, '+' is the unwanted character at the 0th position. Edit accordingly for other characters | |
if(lin[0] == "+"): | |
new_line = lin[1:] | |
print new_line | |
else: | |
new_line = lin | |
#Had to add a "dvs ~ " to each of my formulas in this case. Edit accordingly. | |
new_line = "dvs ~ " + new_line | |
new_form.write(new_line) | |
new_form.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment