Skip to content

Instantly share code, notes, and snippets.

@exemplum100
Created July 16, 2023 09:45
Show Gist options
  • Save exemplum100/5216401c07f8809917dc1408816bac6f to your computer and use it in GitHub Desktop.
Save exemplum100/5216401c07f8809917dc1408816bac6f to your computer and use it in GitHub Desktop.
Quote data to sql something
# simple quote val
# exmpl: '1000000000','2222222','333333333'
x='''10000000000000000000
222222222222222222222
3333333333333333333
4444444444444444444444
55555555555555555555555
'''
def formz(x):
y=x.rstrip().replace('\n','\',\'') # '\n','\',\'' '\n',','
y='\''+y+'\''
return y
with open('SQLquote.txt', 'wt') as xfile:
xfile.write(formz(x))
xfile.close()
print('SQLquote.txt ready')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment