How to get the webpage with socks5 proxy in python3?

2017-09-23 Thread Length Power
sudo lsof -i:1080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME sslocal 1795 root4u IPv4 16233 0t0 TCP localhost:socks (LISTEN) sslocal 1795 root5u IPv4 16234 0t0 UDP localhost:socks An app was listening on localhost:1080,it is ready for curl's so

How to get the webpage with socks5 proxy in python3?

2017-09-23 Thread Length Power
sudo lsof -i:1080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME sslocal 1795 root4u IPv4 16233 0t0 TCP localhost:socks (LISTEN) sslocal 1795 root5u IPv4 16234 0t0 UDP localhost:socks An app was listening on localhost:1080,it is ready for curl's soc

how to select all the monday form "20150101" till "20150620"?

2015-01-05 Thread length power
import pandas as pd rng = pd.date_range("20150101","20150620",freq="D") for day in rng: x = pd.to_datetime(day) y = x.timetuple().tm_wday if(y == 0) :print(x.strftime("%Y%m%d")) I have selected all the monday form "20150101" till "20150620",how to make it more simple? -- https://mail.p

the logical operation confused me

2014-04-10 Thread length power
>>> "ok" or "not ok" 'ok' >>> "ok" and "not ok" 'not ok' >>> why "ok" or "not ok" output "ok" , "ok" and "not ok" output "not ok" ? -- https://mail.python.org/mailman/listinfo/python-list

why i have the output of [None, None, None]

2014-04-10 Thread length power
>>> x=['','x1','x2','x3',' '] >>> x ['', 'x1', 'x2', 'x3', ' '] >>> [print("ok") for it in x if it.strip() !=""] ok ok ok [None, None, None] i understand there are three 'ok' in the output,but why i have the output of [None, None, None] -- https://mail.python.org/mailman/listinfo/python-list

how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

2014-04-09 Thread length power
>>> x=["a","b",["c","d"],"e"] >>> y=x[2] >>> y ['c', 'd'] >>> x.insert(2,y[0]) >>> x ['a', 'b', 'c', ['c', 'd'], 'e'] >>> x.insert(3,y[1]) >>> x ['a', 'b', 'c', 'd', ['c', 'd'], 'e'] >>> del x[4] >>> x ['a', 'b', 'c', 'd', 'e'] >>> maybe there is a more smart way to do. -- https://mail.python.org/

Re: How to display chinese character in 65001 in pytohn?

2014-04-09 Thread length power
problem solved.if you enter python by python(command line),the problem can't be solved.if you enter python by cmd ,and input python,no problem happen. 2014-04-10 11:05 GMT+08:00 length power : > i tried this way ,and post it in stackoverflow,please see: > maybe it is the best answer.

Re: How to display chinese character in 65001 in pytohn?

2014-04-09 Thread length power
oredirect=1#comment35087732_22977409 2014-04-10 10:27 GMT+08:00 MRAB : > On 2014-04-10 02:54, length power wrote: > >> I am in win7 +python3.3. >> >> import os >> os.system("chcp 936") >> fh=open("test.ch <http://test.ch&

How to display chinese character in 65001 in pytohn?

2014-04-09 Thread length power
I am in win7 +python3.3. import os os.system("chcp 936") fh=open("test.ch","w",encoding="utf-8") fh.write("你") fh.close() os.system("chcp 65001") fh=open("test.ch","r",encoding="utf-8").read() print(fh) Äã >>> print(fh.encode("utf-8")) b'\xe4\xbd\xa0'

Re: how to insert the elements in a list properly?

2014-04-09 Thread length power
range(0,2)] >>> [words.append(words.pop(2)) for i in range(0,2)] [None, None] 2014-04-09 18:46 GMT+08:00 Peter Otten <__pete...@web.de>: > length power wrote: > > > word=["x1","x2","x3","x4","x5"] > > w=w

how to insert the elements in a list properly?

2014-04-09 Thread length power
word=["x1","x2","x3","x4","x5"] w=word[-2:] del word[-2:] word.insert(2,w) word ['x1', 'x2', ['x4', 'x5'], 'x3'] what i want to get is ['x1', 'x2', 'x4', 'x5', 'x3'] how can i insert them ? -- https://mail.python.org/mailman/listinfo/python-list

is there more simple way to do?

2014-04-09 Thread length power
x='name,sex,birthday\n\nx1,male,1948/05/28\n\nx2,female,1952/03/27 \n\nx3,female,1994/12/09' x.replace("\n\n","\n").splitlines() is there more simple way to replace `x.replace("\n\n","\n").splitlines()` ? -- https://mail.python.org/mailman/listinfo/python-list