[PYTHON] One liner to talk somewhere

Please note that it does not go down too much.

You can see that the handling of strings in Python2 and Python3 is different. Python3 is easy because there is no conversion between Unicode character string and byte character string.

python2


#Standard input / output is UTF-8 assumptions

# Python2.7
$ python -c "import sys;print(u'\"'.join(unicode(sys.argv[1], 'utf-8')))"Through that, there is Kanharuntayo.
#When"O"Shi"hand"So"This"hand"Or"Hmm"Is"Ru"Hmm"Ta"Yo"Mm"Mm"Mm"Mm

# Python3.3
$ python -c "import sys;print('\"'.join(sys.argv[1]))"Through that, there is Kanharuntayo.
#When"O"Shi"hand"So"This"hand"Or"Hmm"Is"Ru"Hmm"Ta"Yo"Mm"Mm"Mm"Mm

Recommended Posts

One liner to talk somewhere
One liner to 100% CPU1 core usage in Python
One liner to make Lena images with scipy
One liner in Python
python Zundko One Liner
One Liner Web Server
String shuffle one liner
One Liner Zundco Check
One liner to hit if you forget where today is
curl -I python one liner
One liner that formats JSON to make it easier to see
How to convert 0.5 to 1056964608 in one shot
[Bash] Command to write a file line by line to a serial number file [One liner (?)]