Extract the package list from pypi simple api efficiently.

2020-10-30 Thread Hongyi Zhao
Hi, The pypi exposes its simple api at , which can be used to extract the complete package name list. I want to do the job efficiently and write the following simple codes: import requests proxies = { 'http': 'socks5h://127.0.0.1:1', 'https':

Re: revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-17 Thread Hongyi Zhao
On Sun, 17 Nov 2019 20:28:55 +0100, Pieter van Oostrum wrote: > To be honest, I myself would use Emacs, with rgrep and wgrep to do this. Are these tools superior to grep? Regards -- https://mail.python.org/mailman/listinfo/python-list

revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-17 Thread Hongyi Zhao
Hi, I have a lot of files which resides under a directory, and I want to resive all of the content "([^/]+)$" in these files into '([^/]+)$'. I have tried with sed/xargs, but it seems so difficult for dealing with the \ , is there any convinent method to to this job with python? Regards

Is there some python libary for edit iso file drectly?

2019-11-04 Thread Hongyi Zhao
Is there some python libary for edit iso file drectly? -- https://mail.python.org/mailman/listinfo/python-list

Re: python -m pip install and pip install

2019-10-17 Thread Hongyi Zhao
On Fri, 11 Oct 2019 13:02:26 +0530, Pankaj Jangid wrote: > Oh! I wasn't aware of this Windows thing. Thanks. Windows is suck, don't use it at all. -- https://mail.python.org/mailman/listinfo/python-list

Re: python -m pip install and pip install

2019-10-17 Thread Hongyi Zhao
On Fri, 11 Oct 2019 07:35:23 +0300, אורי wrote: > When you upgrade pip, you have to write: > > python -m pip install --upgrade pip > > When you install or upgrade anything else, you can write "pip install". > > You can't upgrade pip using "pip install --upgrade pip". No, see the following:

Re: python -m pip install and pip install

2019-10-08 Thread Hongyi Zhao
Cameron Simpson 于2019年10月8日周二 下午12:25写道: > > On 08Oct2019 02:49, Hongyi Zhao wrote: > >On Tue, 08 Oct 2019 06:28:05 +0530, Pankaj Jangid wrote: > >> A very good use-case is when you have both, python2 and python3 > >> installed. > >> python2 -m pip inst

Re: python -m pip install and pip install

2019-10-08 Thread Hongyi Zhao
Hongyi Zhao 于2019年10月8日周二 下午4:53写道: > > Cameron Simpson 于2019年10月8日周二 下午12:25写道: > > > > On 08Oct2019 02:49, Hongyi Zhao wrote: > > >On Tue, 08 Oct 2019 06:28:05 +0530, Pankaj Jangid wrote: > > >> A very good use-case is when you have both, python2 and p

Re: python -m pip install and pip install

2019-10-07 Thread Hongyi Zhao
On Tue, 08 Oct 2019 06:28:05 +0530, Pankaj Jangid wrote: > A very good use-case is when you have both, python2 and python3 > installed. > > python2 -m pip install mod If so, why not just: pip2 install mod > > and > > python3 -m pip install mod and using: pip3 install mod > > will

python -m pip install and pip install

2019-10-07 Thread Hongyi Zhao
Hi, What's the diff: python -m pip install mod and pip install mod -- https://mail.python.org/mailman/listinfo/python-list

from ./.. import

2019-10-04 Thread Hongyi Zhao
Hi, See this file: https://github.com/hongyi-zhao/dotbot/blob/master/dotbot/messenger/ messenger.py It has the following codes: from ..util.singleton import Singleton from ..util.compat import with_metaclass from .color import Color from .level import Level I just cannot figure out why

a &= b

2019-10-04 Thread Hongyi Zhao
Hi, Could you please give me some more hints on: a &= b It's very difficult for me to understand. -- https://mail.python.org/mailman/listinfo/python-list

Re: uses both shell and python codes in one script.

2019-10-03 Thread Hongyi Zhao
On Thu, 03 Oct 2019 23:12:45 +1000, Chris Angelico wrote: > Seems fine. Most of the code is elsewhere, and presumably has been > written to support both Py2 and Py3; the file you're linking to is > *just* a wrapper that finds an interpreter to use. > > Though this should be unnecessary. A

uses both shell and python codes in one script.

2019-10-03 Thread Hongyi Zhao
See this file: https://github.com/hongyi-zhao/dotbot/blob/master/bin/dotbot It uses both shell and python codes in one script, is this good practice? -- https://mail.python.org/mailman/listinfo/python-list

Re: ipython in different loctions.

2019-10-02 Thread Hongyi Zhao
On Thu, 03 Oct 2019 10:19:23 +1000, Cameron Simpson wrote: > bash -x ~/.pyenv/shims/ipython3 > > and see what its final command does. Tried as follows: - werner@localhost:~$ bash -x ~/.pyenv/shims/ipython3 + set -e + '[' -n '' ']' + program=ipython3 + [[ ipython3 =

ipython in different loctions.

2019-10-02 Thread Hongyi Zhao
Hi, I noticed that the ipython on my Debian box located in the following locations: werner@localhost:~$ ls .local/bin/ipython* .local/bin/ipython .local/bin/ipython3 werner@localhost:~$ ls .pyenv/shims/ipython* .pyenv/shims/ipython .pyenv/shims/ipython3 And, they are different:

Re: python socket dns query will get the correct result while the dig will not.

2019-10-02 Thread Hongyi Zhao
On Wed, 02 Oct 2019 16:28:40 +1000, Chris Angelico wrote: > When you ask dig, you are always asking for a DNS lookup. But > gethostbyname does a lot of other things too. What other things, could you please give more detailed hints? > My guess is that your > /etc/hosts has an entry for that

python socket dns query will get the correct result while the dig will not.

2019-10-01 Thread Hongyi Zhao
Hi, See my following test: With ipython: In [1]: import socket In [2]: socket.gethostbyname ('www.vpngate.net') Out[2]: '130.158.75.44' With dig: $ dig www.vpngate.net @114.114.114.114 +short

ypeError: decoding str is not supported

2019-09-28 Thread Hongyi Zhao
Hi, I have some code comes from python 2 like the following: str('a', encoding='utf-8') But for python 3, this will fail as follows: >>> str('a', encoding='utf-8') Traceback (most recent call last): File "", line 1, in TypeError: decoding str is not supported How to fix it? --

NameError: name 'msvcrt' is not defined

2019-09-26 Thread Hongyi Zhao
Hi, I use python on Debian, when running some python codes, I meet the following error: --- input_username.py", line 18, in read_input if msvcrt.kbhit(): NameError: name 'msvcrt' is not defined How to solve this issue? --

Obtain all the content from https://free-ss.site/ by pycurl/requests.

2019-09-22 Thread Hongyi Zhao
Hi, I try to obtain the content from https://free-ss.site/ by pycurl/requests. But it seems that the above tools cannot get all of the content as the stuff obtained by the firefox. Is is possible to get all of the content just as the results via firefox for this website by using

Obtain the file's path.

2019-09-17 Thread Hongyi Zhao
See the following two methods for obtaining the file's path: os.path.realpath(file) or os.path.abspath(os.path.expanduser(file)) Which is more robust? -- https://mail.python.org/mailman/listinfo/python-list

Using a usb to boot and install the Debian os on my harddisk.

2019-09-17 Thread Hongyi Zhao
Hi, Is some python tools to make a bootable usb and then using it to install the following dvd-iso into my harddisk: https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/debian-10.1.0- amd64-DVD-1.iso Regards -- https://mail.python.org/mailman/listinfo/python-list

What is the Difference Between quit() and exit() commands in Python?

2019-09-16 Thread Hongyi Zhao
What is the Difference Between quit() and exit() commands in Python? -- https://mail.python.org/mailman/listinfo/python-list

``pipenv + pycharm'' refrash/rescan packages index without restart pycharm.

2019-09-15 Thread Hongyi Zhao
Hi, I use pycharm with pipenv for env management. When I do some changes on the packages, say, add/remove some of them. How to let pycharm efrash/ rescan packages index without restart it? -- https://mail.python.org/mailman/listinfo/python-list

# type: a

2019-09-15 Thread Hongyi Zhao
Hi, In pycharm, when I commented out the following line: # type: a The pycharm still told me that: Unresolved reference 'a' Till I commented like the following, the warning will disappear: # type: # a Why? -- https://mail.python.org/mailman/listinfo/python-list

Re: Bool variable with json.dumps

2019-09-15 Thread Hongyi Zhao
On Sun, 15 Sep 2019 19:36:20 +1000, Cameron Simpson wrote: > Because that's how the true value is spelt in JavaScript. You _are_ > aware that JSON is "JavaScript Object Notation", are you not? So > json.dumps translates Python values into JavaScript syntax. > > This is likely to be the same

Bool variable with json.dumps

2019-09-15 Thread Hongyi Zhao
Hi, var = True when json.dumps on it, it will become the form `true' Why? -- https://mail.python.org/mailman/listinfo/python-list

The differences between json.dumps and json.loads.

2019-09-13 Thread Hongyi Zhao
I'm very confusing on the the differences between json.dumps and json.loads. Any hints? -- https://mail.python.org/mailman/listinfo/python-list

what's the differences: None and null?

2019-09-13 Thread Hongyi Zhao
what's the differences: None and null? -- https://mail.python.org/mailman/listinfo/python-list

Re: Append some stuff into a file with only the last appended line reserved.

2019-09-03 Thread Hongyi Zhao
On Tue, 03 Sep 2019 08:29:31 +1000, Cameron Simpson wrote: > Please describe this in more detail. Present a little pycurl output and > then explain what portion of it should land in the log file. See the following code from here: http://pycurl.io/docs/latest/callbacks.html#xferinfofunction

Re: Execute complex shell commands within python and obtain the output.

2019-09-03 Thread Hongyi Zhao
On Tue, 03 Sep 2019 17:27:59 +1000, Cameron Simpson wrote: > It was merely that it is hardwired in your code (and you need to wire in > something). Just keep in mind that _if_ this script runs in a non-utf8 > environment the decoding may be wrong. Unlikely to actually happen > though. Thanks,

Re: Execute complex shell commands within python and obtain the output.

2019-09-02 Thread Hongyi Zhao
On Tue, 03 Sep 2019 08:24:17 +1000, Cameron Simpson wrote: > It seems reasonable to me, but I would not use stderr=subprocess.STDOUT. > Why did you do that? The stderr stream pretty much exists to avoid > polluting stdout with error messages. Thanks for your suggestion. > > For really complex

Execute complex shell commands within python and obtain the output.

2019-09-02 Thread Hongyi Zhao
Hi, I try to execute some complex shell commands with in python and obtain the output, I tried the following method: For python 3.x: import subprocess cmd= some_complex_command_with_pipe_and_others ps = subprocess.Popen (cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT) output =

a,b = 2,3 and [a,b] = [2,3]

2019-09-02 Thread Hongyi Zhao
Hi, What's differences: a,b = 2,3 and [a,b] = [2,3] Regards -- https://mail.python.org/mailman/listinfo/python-list

``if var'' and ``if var is not None''

2019-09-01 Thread Hongyi Zhao
Hi, The following two forms are always equivalent: ``if var'' and ``if var is not None'' Regards -- https://mail.python.org/mailman/listinfo/python-list

Append some stuff into a file with only the last appended line reserved.

2019-08-31 Thread Hongyi Zhao
Hi: I want to append some log of pycurl's downloading info to file, and I only want to reserve the last appended line when write. How to do this? -- https://mail.python.org/mailman/listinfo/python-list

Re: if STREAM.isatty():

2019-08-30 Thread Hongyi Zhao
On Sat, 31 Aug 2019 09:11:22 +1000, Cameron Simpson wrote: > '\r' + progress_status > > which backs up to the start of the line, writes the status, and leaves > the cursor at the end. > > The latter has the advantage that any subsequent output (egthe shell > prompt after the programmke exits)

Re: if STREAM.isatty():

2019-08-30 Thread Hongyi Zhao
On Fri, 30 Aug 2019 10:25:10 -0600, Michael Torrie wrote: > No it is not. What kind of terminal are you using? I use Debian 9 with gnome desktop and the default gnome terminal. -- https://mail.python.org/mailman/listinfo/python-list

Re: if STREAM.isatty():

2019-08-30 Thread Hongyi Zhao
On Fri, 30 Aug 2019 18:42:51 +1000, Chris Angelico wrote: > There is no magic here. It is simply asking a question, and then making > a decision based on the answer. What's your mean by saying this? Sorry for my poor English. -- https://mail.python.org/mailman/listinfo/python-list

Re: if STREAM.isatty():

2019-08-30 Thread Hongyi Zhao
On Fri, 30 Aug 2019 17:53:02 +1000, Chris Angelico wrote: > That's because sys.stderr is never changing in your example here. Try > checking whether sys.stdout is a TTY instead. OMG, thanks a lot, this does the trick. > > (Also, why the sleep? Seems unnecessary.) Because without using sleep,

Re: if STREAM.isatty():

2019-08-30 Thread Hongyi Zhao
On Thu, 29 Aug 2019 16:42:44 +0100, Rhodri James wrote: > I don't understand what's to not to understand. > >if condition: > do_something_because_condition_is_true() >else: > do_something_because_condition_is_false() > > is a perfectly normal construction. If you mean

Re: if STREAM.isatty():

2019-08-30 Thread Hongyi Zhao
On Fri, 30 Aug 2019 01:29:48 +0200, Peter Otten wrote: > Perhaps a simple example can help? > > $ cat checktty.py import sys > > stream = sys.stdout > > if stream.isatty(): > message = "tty" > else: > message = "no tty" > print(message, file=stream) > > When you run the script it

Re: if STREAM.isatty():

2019-08-29 Thread Hongyi Zhao
On Thu, 29 Aug 2019 16:42:44 +0100, Rhodri James wrote: > I don't understand what's to not to understand. > >if condition: > do_something_because_condition_is_true() >else: > do_something_because_condition_is_false() > > is a perfectly normal construction. If you mean

Re: if STREAM.isatty():

2019-08-29 Thread Hongyi Zhao
On Thu, 29 Aug 2019 14:51:43 +0100, Rhodri James wrote: > When the stream isn't connected to an interactive terminal, obviously. > For example, when it's writing to file. But I cannot see any thing like this in the code. Regards -- https://mail.python.org/mailman/listinfo/python-list

Re: if STREAM.isatty():

2019-08-29 Thread Hongyi Zhao
On Thu, 29 Aug 2019 13:23:07 +0100, Rhodri James wrote: > TLDR: these two lines set up (but don't output) a progress message for > an interactive stream. Thanks a lot for your deeply notes on this. But, if so, when will the ``else ...'' be executed in the original code: if

if STREAM.isatty():

2019-08-28 Thread Hongyi Zhao
Hi, I read the following code: https://github.com/shichao-an/homura/blob/master/homura.py On the line 265-266, it said: if STREAM.isatty(): p = (self.progress_template + '\r') % params What's mean by using the above two lines? Can I not use them? Regards --

Let the copyfilepath.py to support chinese file path name.

2019-08-23 Thread Hongyi Zhao
Hi, The following is a gedit plugin which provides a way to copy the current file path to the clipboard. https://github.com/willianveiga/gedit-copy-file-path/blob/master/ copyfilepath.py But, I try and find that it doesn't support the path/file names including chinese characters. In this

Using scapy to defeat the dns poisoning, is it possible?

2019-08-19 Thread Hongyi Zhao
71.248.65 (49) 06:49:35.824454 IP 8.8.8.8.53 > 192.168.1.2.59443: 56457 3/0/1 CNAME twitter.com., A 104.244.42.129, A 104.244.42.65 (90) As you can see, the dns is poisoned, is it possible to defeat this with scapy or some techniques with python? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmai

dnsstamp.py failed to parse the 'sdns://' string.

2019-08-18 Thread Hongyi Zhao
Hi, I installed the https://pypi.org/project/dnsstamps/, and parsing the DNS stamps string of google dns, I meet the following error: $ dnsstamp.py parse sdns://

Re: Your IDE's?

2019-08-16 Thread Hongyi Zhao
On Fri, 16 Aug 2019 16:10:51 -0700, Paul Rubin wrote: > Does Microsoft have another product that is similar to Atom? What is > it? > Just wondering. I use Emacs myself. vscode: https://code.visualstudio.com/ -- https://mail.python.org/mailman/listinfo/python-list

Re: About the #python irc channel on freenode.

2019-08-12 Thread Hongyi Zhao
011) - I've tried to register the nickname as it told. But still cannot success. Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

About the #python irc channel on freenode.

2019-08-12 Thread Hongyi Zhao
Hi, Sorry for bothering here for this not technically python issue. I want to chat some issues on the #python irc channel hosted on freenode. But try so many times still cann't succeed. Could anyone here give me some hint if you can successfully do this thing? Regards -- .: Hongyi Zhao

For the code to generate `zen of python'.

2019-08-07 Thread Hongyi Zhao
ne please give me some explanations on it? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

base = 1024 if (gnu or binary) else 1000

2019-08-05 Thread Hongyi Zhao
? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

_unquote

2019-08-04 Thread Hongyi Zhao
' used above? What's the meaning of it? I cannot find its definition from the python's shipped packages. Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

if bytes != str:

2019-08-04 Thread Hongyi Zhao
:' here? I mean, this will always return True, IMO. See my following test in ipython: In[20]: bytes != str Out[20]: True Any hints on this? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Why they use this: duration = time.time() - self.start_time + 1

2019-08-03 Thread Hongyi Zhao
-- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Using pycurl to obtain the download speed in real-time for a huge file.

2019-08-02 Thread Hongyi Zhao
Hi, I want to use pycurl to obtain the download speed in real-time for a huge file. Is this possible or not? Any hints on this issue? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

conda: Fetching package metadata: SSL verification error: EOF occurred in violation of protocol (_ssl.c:645)

2016-04-09 Thread Hongyi Zhao
-- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Re: Failed to update the os.environ with subprocess.Popen.

2016-04-03 Thread Hongyi Zhao
On Sun, 03 Apr 2016 18:20:31 +1000, Cameron Simpson wrote: > In particular, you want the subprocess' output. As written, your code > sets "output" to the Popen object. You actually want to set it to the > .stdout attribute of that object, which is the output from the > subcommand. Based on your

Re: Get the output from a Popen instance (was: Failed to update the os.environ with subprocess.Popen.)

2016-04-02 Thread Hongyi Zhao
On Sun, 03 Apr 2016 13:37:24 +1000, Ben Finney wrote: >> But, I meet the following errors: >> >> >> Traceback (most recent call last): >> File "/home/werner/software/hpc/dft-to-study/jasp/jasp.git/jasp/bin/ >> runjasp.py", line 125, in >>

Failed to update the os.environ with subprocess.Popen.

2016-04-02 Thread Hongyi Zhao
o attribute 'split' --- How to solve this issue? -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Failed to update the os.environ with subprocess.Popen.

2016-04-02 Thread Hongyi Zhao
o attribute 'split' --- How to solve this issue? -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Failed to update the os.environ with subprocess.Popen.

2016-04-02 Thread Hongyi Zhao
o attribute 'split' --- How to solve this issue? -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Re: Using python heredoc to substitute the external file read by python script.

2016-03-28 Thread Hongyi Zhao
On Mon, 28 Mar 2016 21:29:48 +1100, Ben Finney wrote: >> If I want to use python heredoc to substitute this external file for >> the above codes. Is this possible? > > What do you mean by “Python heredoc”? What Python feature are you > referring to? I find the following methods currently:

Using python heredoc to substitute the external file read by python script.

2016-03-28 Thread Hongyi Zhao
n the above codes, I use the file /home/werner/env-intel-toolchains.sh for subprocess.check_output to use for its operation. If I want to use python heredoc to substitute this external file for the above codes. Is this possible? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com

Re: Calling the source command from subprocess.popen to update the os.environ.

2016-03-27 Thread Hongyi Zhao
On Sun, 27 Mar 2016 13:24:05 +, Hongyi Zhao wrote: > # replace env > os.environ.clear() I find another method which can solve this issue, ie., changing the above code into the follows: # ref : http://unix.stackexchange.com/questions/178522/unsetting- environment-variable-with-an

Calling the source command from subprocess.popen to update the os.environ.

2016-03-27 Thread Hongyi Zhao
File "/home/werner/anaconda2/lib/python2.7/os.py", line 501, in clear unsetenv(key) OSError: [Errno 22] Invalid argument If I don't use the `os.environ.clear()' code line, it will work smoothly. Any hints? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Settig some environment variables from within python.

2016-03-23 Thread Hongyi Zhao
Hi all, I want to submit a qsub job to my hpc cluster from within python. In this case, I must set some environment variables specific for this qsub job and then invoking a bash script from within python. What python code should be used for this job? Regards -- .: Hongyi Zhao [ hongyi.zhao

Re: Obtain the variable in bash.

2016-03-23 Thread Hongyi Zhao
g; it > depends how your system is configured. I tried and find that I must set the variable in .profile file, instead of .bashrc, in order to let the IDEs started from my GUI to recognize them after I logged out and in again. Regards > > ChrisA -- .: Hongyi Zhao [ hongyi.zhao AT gma

Obtain the variable in bash.

2016-03-23 Thread Hongyi Zhao
d wing ide, I failed the obtain the value of this variable. I'm very confused with this issue. Any hints? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

TypeError: write_png() takes at most 3 arguments (5 given)

2016-03-20 Thread Hongyi Zhao
ite_png() takes at most 3 arguments (5 given) Any hints for this issue? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it possiable to find the fastest ones of dns servers from a huge number of them fastly with python?

2016-03-01 Thread Hongyi Zhao
using. > > ChrisA -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Is it possiable to find the fastest ones of dns servers from a huge number of them fastly with python?

2016-03-01 Thread Hongyi Zhao
Hi all, I've a huge number of dns servers, around +5000, and I want to find the top 50 fastest ones out of them for my location. Is it possible for this type of thing using python under my Debian Jessie box? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom

Re: Mimick tac with python.

2016-01-29 Thread Hongyi Zhao
On Fri, 29 Jan 2016 23:58:38 -0500, Random832 wrote: > python <(echo 'import sys;print("".join(reversed(list(sys.stdin') Why do you write it as follows: cat input_file | python -c 'import sys;print("".join(reversed(list (sys.stdin))))' Regards -- .: Hongyi Zhao

Mimick tac with python.

2016-01-29 Thread Hongyi Zhao
Hi all, I can use the following methods for mimicking tac command bellow: awk '{a[NR]=$0} END {while (NR) print a[NR--]}' input_file perl -e 'print reverse<>' input_file Is it possible to do the same thing with python? Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in F

45

2016-01-13 Thread Hongyi Zhao
rt -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Re: Want to readout the control file of aria2.

2015-06-09 Thread Hongyi Zhao
On Tue, 09 Jun 2015 18:52:00 -0400, Joel Goldstick wrote: I found this: http://aria.pasteur.fr/developers/aria-python-api Does that help? The aria mentioned by your above links is completely different thing WRT the one I posted here ;-( Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com

Re: Want to readout the control file of aria2.

2015-06-09 Thread Hongyi Zhao
On Tue, 09 Jun 2015 23:29:43 +, Hongyi Zhao wrote: On Wed, 10 Jun 2015 00:58:41 +0200, Laura Creighton wrote: No promises -- I never used this myself, but it looks like: https://github.com/killuahzl/pyaria2 parses pyaria files for its own purposes, so you could steal code from

Re: Want to readout the control file of aria2.

2015-06-09 Thread Hongyi Zhao
that I want. Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Re: Want to readout the control file of aria2.

2015-06-09 Thread Hongyi Zhao
control file of aria2 ( *.aria2 ). Regards -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- https://mail.python.org/mailman/listinfo/python-list

Want to readout the control file of aria2.

2015-06-09 Thread Hongyi Zhao
Hi all, I want to read out the control file of aria2, which is a binary file including the data format depicted here: http://aria2.sourceforge.net/manual/en/html/technical-notes.html Could you please give me some snipped codes for this purpose? Regards -- .: Hongyi Zhao [ hongyi.zhao

Re: Want to write a script to do the batch conversion from domain name to IP.

2009-01-31 Thread Hongyi Zhao
On Sat, 31 Jan 2009 04:10:39 -0200, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Fri, 30 Jan 2009 12:53:33 -0200, Hongyi Zhao hongyi.z...@gmail.com escribi$)A(.: See the following errors I in my case: $ python 'import site' failed; use -v for traceback import socket Traceback

Want to write a script to do the batch conversion from domain name to IP.

2009-01-30 Thread Hongyi Zhao
Hi all, Suppose I've the entries like the following in my file: -- 116.52.155.237:80 ip-72-55-191-6.static.privatedns.com:3128 222.124.135.40:80 217.151.231.34:3128 202.106.121.134:80 211.161.197.182:80 hpc.be.itu.edu.tr:80 static3-117-183.worldinternetworkcorporation.com:80

Re: Want to write a script to do the batch conversion from domain name to IP.

2009-01-30 Thread Hongyi Zhao
' is not defined -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- http://mail.python.org/mailman/listinfo/python-list

Re: Want to write a script to do the batch conversion from domain name to IP.

2009-01-30 Thread Hongyi Zhao
On Fri, 30 Jan 2009 22:48:00 +0800, Hongyi Zhao hongyi.z...@gmail.com wrote: On Fri, 30 Jan 2009 05:41:29 -0800 (PST), Jeff McNeil j...@jmcneil.net wrote: [snipped] Why not just use socket.gethostbyname? Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49) [GCC 4.3.2] on linux2 Type help, copyright