Re: Merging multiple sorted sequences.

2017-04-17 Thread Andre Müller
Hi, when you have lists with different lengths and want to zip them, you should look at itertools.zip_longest Greetings Andre -- https://mail.python.org/mailman/listinfo/python-list

Re: write arrays to disk

2017-04-17 Thread Andre Müller
Hi, there are many possible solutions. You'll need a serialiser to convert the Python object into bytes. If you wan't to access the data from other applications, you can use json, xml or other well known formats. Json and XML is in the Python standard library. You can also use a database. As

Re: Bigotry and hate speech on the python mailing list

2017-04-18 Thread Andre Müller
t politics, war and hate? Then just make a new constitution. Greetings Andre Müller signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: pyserial and end-of-line specification

2017-07-15 Thread Andre Müller
Just take a look into the documentation: https://docs.python.org/3/library/io.html#io.TextIOWrapper And in the example of Pyserial: http://pyserial.readthedocs.io/en/latest/shortintro.html#eol I think it shold be: sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser), newline='yourline_ending')

Re: Regular expression

2017-07-26 Thread Andre Müller
fname = 'first-324-True-rms-kjhg-Meterc639.html' # with string manipulation stem, suffix = fname.rsplit('.', 1) print(stem[-4:]) # oo-style with str manipulation import pathlib path = pathlib.Path(fname) print(path.stem[-4:]) -- https://mail.python.org/mailman/listinfo/python-list

Re: why are these 2 fucking clowns in here ?

2017-06-30 Thread Andre Müller
Just don't read it. Calm down. -- https://mail.python.org/mailman/listinfo/python-list

Re: Practice Python

2017-05-10 Thread Andre Müller
Hello, 1.) a short example for Python 3, but not exactly what they want. def square(numbers): yield from sorted(n**2 for n in numbers) numberlist = [99, 4, 3, 5, 6, 7, 0] result = list(square(numberlist)) To solve this tutorial, you need a different way. I'm just showing how sexy Python 3

Re: Practice Python

2017-05-10 Thread Andre Müller
Am 10.05.2017 um 14:18 schrieb Chris Angelico: > On Wed, May 10, 2017 at 10:11 PM, Andre Müller <gbs.dead...@gmail.com> wrote: >> 1.) a short example for Python 3, but not exactly what they want. >> >> def square(numbers): >> yield from sorted(n**2 for n in n

Re: Referring to a module by a string without using eval()

2017-05-17 Thread Andre Müller
Peter Otten <__pete...@web.de> schrieb am Mi., 17. Mai 2017 um 09:31 Uhr: > jeanbigbo...@gmail.com wrote: > > > I am trying to write some recursive code to explore the methods, classes, > > functions, builtins, etc. of a package all the way down the hierarchy. > > > 2) I ultimately need to create

Re: os.walk the apostrophe and unicode

2017-06-24 Thread Andre Müller
Can os.fsencode and os.fsdecode help? I've seen it somewhere. I've never used it. To fix encodings, sometimes I use the module ftfy Greetings Andre -- https://mail.python.org/mailman/listinfo/python-list

Re: A Good Tutorial on Python Decorators

2017-06-27 Thread Andre Müller
Activate JavaScript, then you can see the content. I had the same problem. Peter Pearson schrieb am Di., 27. Juni 2017 um 18:35 Uhr: > On Tue, 27 Jun 2017 15:10:53 + (UTC), Saurabh Chaturvedi wrote: > > https://opensource.google.com/projects/py-decorators-tutorial

Re: Hello from a super noob!

2017-06-08 Thread Andre Müller
Hello, you can refactor your code a little bit and learn more about exceptions: def get_numbers(): first = None second = None while True: try: if first is None: first = int(input('Enter your first number: ')) if second is None:

Re: Converting epoch to string in format yyyy-mm-dd, or maybe it is not necessary

2017-06-14 Thread Andre Müller
I'm not familar with pandas. If you look on stackoverfolow you'll find this solution: df.epoch = pd.to_datetime(df.epoch) https://stackoverflow.com/questions/17134716/convert-dataframe-column-type-from-string-to-datetime But in this case, it's not a plain string, then it's a datetime object.

Re: How do you use Python 3.5 and Python 3.6 in production

2017-06-14 Thread Andre Müller
Hi, I'm using Arch Linux. There is currently Python 3.6 the standard interpreter. But I think it's not good to use this in production. Hm, maybe pyenv can be an distribution independent solution: https://github.com/pyenv/pyenv If you're using pyenv, then you'll have some build dependencies. One

Re: Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-14 Thread Andre Müller
I'm a fan of infinite sequences. Try out itertools.islice. You should not underestimate this very important module. Please read also the documentation: https://docs.python.org/3.6/library/itertools.html from itertools import islice iterable = range(100) # since Python 3 range is a lazy

Re: API Help

2017-06-14 Thread Andre Müller
Am 14.06.2017 um 22:33 schrieb Bradley Cooper: > I am working with an API and I get a return response in this format. > > >

Re: Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-16 Thread Andre Müller
Am 15.06.2017 um 07:09 schrieb Jussi Piitulainen: > Andre Müller writes: > >> I'm a fan of infinite sequences. Try out itertools.islice. >> You should not underestimate this very important module. >> >> Please read also the documentation: >> https://docs.p

Re: "Python launcher" required to run *.py scripts on Windows?

2017-06-27 Thread Andre Müller
Double Post: https://python-forum.io/Thread-Python-launcher-required-to-run-py-scripts-on-Windows Pleas don't do this. It's not a nice behavior. Thanks. Andre -- https://mail.python.org/mailman/listinfo/python-list

Re: Why no '|' operator for dict?

2018-02-05 Thread Andre Müller
You can use keyword-argument unpacking in a dict-constructor. Values of duplicate keys are overwritten from left to right. The last wins. >>> dict1 = {'foo': 13, 'bar': 42} >>> dict2 = {'foo': 42, 'hello': 'world'} >>> {**dict1, **dict2} {'bar': 42, 'foo': 42, 'hello': 'world'} {**dict2,

Re: Old format with %

2018-02-15 Thread Andre Müller
It can be escaped: "test %d %%" % 7 Terry Reedy schrieb am Mi., 14. Feb. 2018 um 20:53 Uhr: > On 2/14/2018 7:54 AM, ast wrote: > > Le 14/02/2018 à 13:46, ast a écrit : > >> Hello > >> > >> It seems that caracter % can't be escaped > >> > >> >>>"test %d %" % 7 > >> ValueError:

Re: Regex on a Dictionary

2018-02-15 Thread Andre Müller
Hello, this question also came up there: https://python-forum.io/Thread-Working-with-Dict-Object Greetings Andre -- https://mail.python.org/mailman/listinfo/python-list

Re: "Programs" folder not found.

2018-02-15 Thread Andre Müller
Look in %localappdata%\Programs\Python Enerel Amgalan via Python-list schrieb am Do., 15. Feb. 2018 um 14:05 Uhr: > > Hello! So I downloaded “Python” program in C:>Users>(my > name)>AppData>Local>Programs>Python.And then in “Local” folder I can’t find > “Programs”

Re: help me ?

2018-02-27 Thread Andre Müller
Hello, it's a duplicate: https://python-forum.io/Thread-Working-with-lists-homework-2 I have seen this more than one time. We don't like it. You keep people busy with one question at different places. You need two lists and one empty list. One outer loop iterating over the first list and one

Re: recommends of redesign OO feature of python !!!

2018-10-25 Thread Andre Müller
Troll detected! If you don't like Python, don't use it. Very simple. The concept of Python is good as it is. -- https://mail.python.org/mailman/listinfo/python-list