Created
August 19, 2018 14:35
-
-
Save shubhamagarwal92/a133cc06cf8cf08052913cc0642614c4 to your computer and use it in GitHub Desktop.
This script allows to convert excel line (space separated line) to latex table line format
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
__author__='shubhamagarwal92' | |
""" | |
This script allows to convert excel line (space separated line) | |
to latex table line format | |
Usage: | |
Input: | |
>>> Enter text: ABC 0.4742 0.7770 0.8717 4.9432 0.6126 | |
Output: | |
>>> ABC & 0.4742 & 0.7770 & 0.8717 & 4.9432 & 0.6126 \\ | |
""" | |
if __name__=='__main__': | |
while True: | |
try: | |
text = raw_input("Enter text: ") | |
if text == "stop" or "": | |
break | |
out_latex_str = ' & '.join(text.split(' ')) | |
# Add double backslash at the end | |
out_latex_str = out_latex_str + ' \\\\' | |
print(out_latex_str) | |
except KeyboardInterrupt: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment