Skip to content

Instantly share code, notes, and snippets.

@starlightme
Created March 16, 2017 13:34
Show Gist options
  • Save starlightme/ae97b3d577fe80239515c8466e06714a to your computer and use it in GitHub Desktop.
Save starlightme/ae97b3d577fe80239515c8466e06714a to your computer and use it in GitHub Desktop.
list2query
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# mainly for sql query
filename = 'test.txt'
with open(filename,'r') as fp:
l = fp.readlines()
l = map( lambda s:s.strip(), l )
result = str(l).replace('[','(').replace(']',')')
print result
with open(filename,'a') as fp:
fp.write(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment