Skip to content

Instantly share code, notes, and snippets.

@alexander-beaver
Created February 23, 2020 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexander-beaver/ca330c43d27357ceb6fde0a58f9b6049 to your computer and use it in GitHub Desktop.
Save alexander-beaver/ca330c43d27357ceb6fde0a58f9b6049 to your computer and use it in GitHub Desktop.
Convert Python
import sys
fileNameToRead = sys.argv[1]
try:
file_object = open(fileNameToRead, 'r')
text = file_object.readlines()
output = []
for line in text:
line = line.replace("network_table:///","")
line = line.replace("LiveWindow/","")
line = line.replace("SmartDashboard/","")
output.append(line)
print(output)
write_object_name = fileNameToRead.replace(".csv","")+"-converted.csv"
write_file = open(write_object_name, 'w+')
for line in output:
write_file.write(line)
write_file.close()
file_object.close()
except Exception as e:
print(str(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment