On Sun, 12 Jan 2020 15:21:52 +0100, ofomi matthew wrote:
> Good day Python Team,
> I'm Matt by name and I have been having difficulties in installing packages
> on my pycharm.it keeps telling me "error installing package". Please how do
> I rectify this issues step by step.
> Looking forward to get
On Sun, 12 Jan 2020 22:23:58 +0530, kiran chawan wrote:
> Whenever Iam trying to run this 'New latest version python software 3.8.4
> python ' but it doesn't show any install option tell me how to run this
> software and install new latest version of python plz reply sir thank you
To get a usef
Tony Flury via Python-list wrote:
>
> On 20/12/2019 18:59, Peter Otten wrote:
>> Chris Angelico wrote:
>>
>>> On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote:
>>>> PS: If you are sorting files by size and checksum as part of a
&g
Frank Millman wrote:
> Hi all
>
> I usually send lxml queries to the lxml mailing list, but it appears to
> be not working, so I thought I would try here.
>
> This is a minor issue, and I have found an ugly workaround, but I
> thought I would mention it.
Like this?
children = list(xml)
for y i
石盼 wrote:
> The problem like this:
> t = time.clock()
> AttributeError: module 'time' has no attribute 'clock'
Quoting
https://docs.python.org/3/whatsnew/3.8.html#api-and-feature-removals
"""
The function time.clock() has been removed, after having been deprecated
since Python 3.3: use time.pe
Parisa Ch wrote:
> x=np.linspace(0,2*math.pi,n)
> n=len(x)
> r=int(math.ceil(f*n))
> h=[np.sort(np.abs(x-x[i]))[r] for i in range(n)]
>
> this is part of a python code. the last line is confusing? x is a matrix
> and x[i] is a number. how calculate x-x[i] for each i?
> why the put r in [] ?
Br
legau...@gmail.com wrote:
> os.system("... {input_pdf} ...".format(..., input_pdf=input_pdf))
> I see it does not like spaces in the file name
Use subprocess.call(), not os.system(), then:
>>> filename = "hello world.txt"
>>> with open(filename, "w") as f: print("Hello, world!", file=f)
...
>>
Stefan Ram wrote:
> The other thing I read in a book. I already knew that one
> can zip using ... »zip«. E.g.,
>
> x =( 'y', 'n', 'a', 'n', 't' )
> y =( 4, 2, 7, 3,1 )
> z = zip( x, y )
> print( list( z ))
> [('y', 4), ('n', 2), ('a', 7), ('n', 3), ('t', 1)]
>
> But the book told me t
On Sun, 16 Feb 2020 14:17:28 -0800 (PST), alberto wrote:
> Hi,
> how I could realize a script to calculate fugacity coefficients
> with this formula
>
[snip]
>
> regards
>
> Alberto
Welcome, Alberto.
Can you make this look more like a Python question and less like a
do-my-homework question? Sho
On 17 Feb 2020 18:40:00 GMT, Peter Pearson wrote:
>
> Welcome, Alberto.
>
> Can you make this look more like a Python question and less like a
> do-my-homework question? Show us what you've tried.
Sorry. I see you already did exactly that.
--
To email me, substitute nowh
On Fri, 28 Feb 2020 18:49:58 -0800, Mr. Lee Chiffre wrote:
[snip]
> I am a python noob. This is why I ask the python masters. There is a
> python software I want to install on the server it is called Electrumx.
> https://github.com/kyuupichan/electrumx is the link. I am having troubles
> with insta
Adam Preble wrote:
> If you don't know, you can trap what super() returns some time and poke it
> with a stick. If you print it you'll be able to tell it's definitely
> unique: , >
>
> If you try to invoke methods on it, it'll invoke the superclass' methods.
> That's what is supposed to happen an
Antoon Pardon wrote:
> I think I can best explain what I want by showing two bash sessions:
> Python 2.6.4 (r264:75706, Sep 9 2015, 15:05:38) [C] on sunos5
> ImportError: No module named cx_Oracle
> Python 2.6.7 (r267:88850, Feb 10 2012, 01:39:24) [C] on sunos5
import cx_Oracle
> As
Paulo da Silva wrote:
> Às 02:18 de 23/03/20, Paulo da Silva escreveu:
>> Hi!
>>
>> Suppose a class C.
>> I want something like this:
>>
>> class C:
>> KA=0
>> KB=1
> KC=2
>> ...
>> Kn=n
>>
>> def __init__ ...
>> ...
>>
>>
>> These constants come from an enum in a .h (header of C file).
>> Th
dcwhat...@gmail.com wrote:
> Hi,
>
> I've tried urllib, requests, and some other options. But I haven't found
> a way to trap certain urls that aren't possible to connect from, outside
> the office. In those cases, I need to just output an error.
>
>
> So, the following code will cover the 40
Antoon Pardon wrote:
>
> I have the following program
>
> class slt:
> __slots__ = ()
>
> def getslots(self):
> print("### slots =", self.__slots__)
> if self.__slots__ == ():
> return []
> else:
> ls = super().getslots()
> ls.extend(self.__slots__)
> return ls
>
> def __str__(self):
> ls = []
Steve Smith wrote:
> I am having the same issue. I can either get the text to wrap, which makes
> all the text wrap, or I can get the text to ignore independent '/n'
> characters, so that all the blank space is removed. I'd like to set up my
> code, so that only 1 blank space is remaining (I'll se
Chris Angelico wrote:
[Steve]
>>>def wrap(self, text):
>>>split_text = text.split('\n')
>>>lines = [line for para in split_text for line in
textwrap.TextWrapper.wrap(self, para)]
[Dennis]
>> That... Looks rather incorrect.
>>
>> In most all list-comprehension
Dieter Maurer wrote:
> Stephan Lukits wrote at 2020-3-31 17:44 +0300:
>>background:
>>
>>- a daemon creates package p1 (e.g. directory with __init__.py-file) and
>>in p1 a module m1 is created.
>>
>>- Then the daemon wants to import from m1, which functions (so far all
>>the time).
>>
>>- Then a m
Is there a Python3 module with financial accounts?
--
Greetings
Peter Wiehe
--
https://mail.python.org/mailman/listinfo/python-list
On 01.04.20 20:02, Tim Chase wrote:
On 2020-04-01 19:27, Peter Wiehe wrote:
Is there a Python3 module with financial accounts?
You'd have to be more specific. For interacting with online accounts
with financial institutions? For tracking financial data locally?
There's beanc
jagmit sandhu wrote:
> python newbie. I can't understand the following about numpy arrays:
>
> x = np.array([[0, 1],[2,3],[4,5],[6,7]])
> x
> array([[0, 1],
>[2, 3],
>[4, 5],
>[6, 7]])
> x.shape
> (4, 2)
> y = x[:,0]
> y
> array([0, 2, 4, 6])
> y.shape
> (4,)
>
> Why is t
Antoon Pardon wrote:
> I am experimenting with subclasses that all need the same metaclass as the
> base class. Is there a way to make the metaclass be inherited, so that you
> don't have to repeat the "metaclass = MetaClass" with every subclass.
?
This is not only possible, this is the default:
Antoon Pardon wrote:
>
>
> Op 9/04/20 om 18:37 schreef Peter Otten:
>> Antoon Pardon wrote:
>>
>>> I am experimenting with subclasses that all need the same metaclass as
>>> the base class. Is there a way to make the metaclass be inherited, so
>>&
Rahul Gupta wrote:
> the cells in my csv that i wrote looks likes this
>
['82#201#426#553#602#621#811#908#1289#1342#1401#1472#1593#1641#1794#2290#2341#2391#3023#3141#3227#3240#3525#3529#3690#3881#4406#4421#4497#4719#4722#4920#5053#5146#5433']
> and the cells which are empty looks like [''] i have
>> csv_reader = csv.DictReader(csv_file)
>> print(csv_reader.fieldnames)
>> col_count = print(len(csv_reader.fieldnames))
>> print(sum(1 for row in csv_file))
>> for line in csv_reader:
>> print(line)
>> but when i print line it show
Rahul Gupta wrote:
> for line in enumerate(csv_reader):
> print(line[csv_reader.fieldnames[1]])
enumerate() generates (index, line) tuples that you need to unpack:
for index, line in enumerate(csv_reader):
print(line[csv_reader.fieldnames[1]])
If you want to keep track o
sjeik_ap...@hotmail.com wrote:
>On 12 Apr 2020 12:30, Peter Otten <__pete...@web.de> wrote:
>
> Rahul Gupta wrote:
>
> >for line in enumerate(csv_reader):
> >print(line[csv_reader.fieldnames[1]])
>
> enumerate() generates (index,
Aakash Jana wrote:
> I am calculating couple of ratios and according to the problem there must
> be a 6 decimal precision. But when I print the result I only get one 0.
> E.g:- 2 / 5 = 0.40 but I am only getting 0.4
Make sure that you are using Python 3, not Python 2 or use at least one
floa
Aakash Jana wrote:
> I am running python 3.8 only but my issue is I need more zeroes after my
> result.
> I want 2/5 = 0.40
> But I am only getting 0.4
This is either a formatting problem
>>> value = 0.4
>>> print(f"{value:10.6f}")
0.40
or -- if you want to *calculate* with a fixed pr
Souvik Dutta wrote:
> You can actually read and write in a file simultaneously. Just replace "r"
> with "w+" if the file has not been previously made or use "r+" is the file
> has already been made.
Good advice for those who like to butcher their data ;)
Seriously, writing modified data into a n
J Conrado wrote:
> I have GOES16 full disk data with the dimensions (5424, 5424) and my
> latitude and longitude arrays have the same dimension.
>
> How can I seletct a small region of this data, using this limits for
> lat=[-30,10] and lon = [-90,-30] for my sector. I try to select my
> region
Unknown wrote:
> Le 19/04/2020 à 17:06, ast a écrit :
>
> I understood where the problem is.
>
> Once __get__ is defined, it is used to read self._name in method
> __set_name__ and it is not défined yet. That's why I have
> an error "'NoneType' object is not callable"
> Thats a nice bug.
It's t
On Tue, 21 Apr 2020 21:42:42 + (UTC), Eli the Bearded wrote:
> This just arrived at my newserver:
>
> Path:
> reader2.panix.com!panix!goblin2!goblin.stu.neva.ru!news.unit0.net!2.eu.feeder.erje.net!4.us.feeder.erje.net!feeder.erje.net!xmission!csiph.com!news.bbs.nz!.POSTED.agency.bbs.nz!not
Moro, Andrea via Python-list wrote:
> Hello there,
>
> I believe there is a bug in the urljoin library.
I believe this is a case of garbage-in garbage-out ;)
Try
p = urlparse(url)
if not p.scheme:
url = urlunparse(p._replace(scheme="http"))
>
> See below:
>
> p = urlparse(url)
> if p.sc
Rahul Gupta wrote:
> consider the following code
> import csv
> import numpy as np
>
> with open("D:\PHD\obranking\\demo.csv", mode='r') as csv_file1,
> open("D:\PHD\obranking\\demo.csv", mode='r') as csv_file2:
> csv_reader1 = csv.DictReader(csv_file1)
> csv_reader2 = csv.DictReader(csv_
Unknown wrote:
> Hello
>
> doctest of the sample function funct() doesn't works
> because flag used by funct() is the one defined in
> first line "flag = True" and not the one in the
> doctest code ">>> flag = False".
>
> Any work around known ?
You can import the module where funct() is define
J Conrado wrote:
> I have a 2d array and I would how can I replace NaN values for example
> with - value or other value.
>>> a
array([[ nan, 1., 2., 3.],
[ 4., 5., 6., 7.],
[ 8., 9., 10., nan]])
>>> a[numpy.isnan(a)] = 42
>>> a
array([[ 42., 1., 2., 3.],
Joydeep C wrote:
> On Sat, 09 May 2020 14:42:43 +0200, Python wrote:
>
>> Joydeep wrote:
>>> I have a Pandas dataframe like below.
>>>
>>> XY
>>> 0 1234567890 1 54321N/A 2 67890123456
>>>
>>> I need to make these numbers comma formatted. For example, 12345 =>
>>> 12,
Dick Holmes wrote:
> https://occovid19.ochealthinfo.com/coronavirus-in-oc
> I'm trying to
> communicate using a continuing dialog between two
> processes on the same system.
I think pexpect
https://pexpect.readthedocs.io/en/stable/index.html
does this naturally, but I don't know if Windows su
Christopher de Vidal wrote:
> Help please? Creating an MQTT-to-Firestore bridge and I know a decorator
> would help but I'm stumped how to create one. I've used decorators before
> but not with arguments.
>
> The Firestore collection.on_snapshot() method invokes a callback and sends
> it three pa
shivani.shi...@alefedge.com wrote:
> Hi,
> I am a beginner to Python. I want to achieve the following:
>
> My directory structure:
>
> a
> └── b
> └── c
> ├── p
> │ └── q
> │ └── test.py
> └── x
> └── y
> └── run.py
>
> In
Larry Martell wrote:
> I have some code that uses the pyvirtualdisplay package and it works fine.
>
> pyvirtualdisplay,Display calls EasyProcess like this:
>
>@classmethod
>def check_installed(cls):
>EasyProcess([PROGRAM, '-help'], url=URL,
>ub
ansari.aafaq1...@gmail.com wrote:
> Lets say i have a expression:
> flowrate=(veloctiy*area)
> i can find the flowrate with this expression
> but if i dont wanna change the expression and want to find the velocity by
> giving it value of area and flowrate ,how do i do this in python? is there
> an
Ciarán Hudson wrote:
> How do I edit the code below to create a csv file which includes the
> information I have printed at the bottom?
>
> I'm pulling arrival data from an airport website and printing out only the
> flight info. I want to save that flight info to a CSV file.
First of all the da
John Yeadon via Python-list wrote:
> Am I unreasonable in expecting this code to exit when required?
It is unreasonable to expect something that doesn't match what you read in
the tutorial ;)
If you want to terminate the script you can use exit. However exit is a
function, and you have to call
Ciarán Hudson wrote:
> This has helped a lot; cleaner output, keeping tbl format and creating a
> csv but the csv is not being populated. Any idea what I am doing wrong?
> writer = csv.writer(sys.stdout)
> writer.writerow([
> 'Arriving From'
> 'Airline',
> 'Scheduled to arrive', 'Late
Ralf M. wrote:
> Hello,
>
> recently I wrote a small library that uses an Enum. That worked as
> expected. Then I added a main() and if __name__ == "__main__" to make it
> runable as script. Now Enum members that should be the same aren't
> identical any more, there seem to be two instances of th
Peter Otten wrote:
>> # Code of mod2.py #
> import __main__ as mod1
>> def getA():
>>return mod1.En.A
>> # End of mod2.py #
>
> but that would hardcode the assumption that __main__ is always mod1.py.
I should have mentioned the cyclic depende
zljubi...@gmail.com wrote:
> Hi,
>
> I have a case in which I have to use custom function for logging.
> For example, all messages should go to stderr and end with '\r\n'.
>
> Can I somehow use standard python logging module but send all message to
> stderr with '\r\n' line endings?
Isn't that
zljubi...@gmail.com wrote:
> Is this OK?
>
> import logging
>
> LOG_LEVEL = logging.getLevelName('DEBUG')
>
> logging.basicConfig(level=LOG_LEVEL,
> format='%(asctime)s %(levelname)s %(name)s
> %(funcName)-20s %(message)s', datefmt='%d.%m.%Y
>
BBT wrote:
> I am trying to parse a word (.docx) for tables, then copy these tables
> over to excel using xlsxwriter. This is my code:
>
> from docx.api import Document
> import xlsxwriter
>
> document = Document('/Users/xxx/Documents/xxx/Clauses Sample - Copy v1 -
> for merge.docx') tables = d
BBT wrote:
> On Thursday, 28 May 2020 01:36:26 UTC+8, Peter Otten wrote:
>> BBT wrote:
>>
>> > I am trying to parse a word (.docx) for tables, then copy these tables
>> > over to excel using xlsxwriter. This is my code:
>> >
>> > f
BBT wrote:
> I tried your code by replacing the Document portion:
> But I received an error:
> TypeError: __init__() takes 1 positional argument but 2 were given
We seem to have different ideas of what replacing means.
Here is the suggested script spelt out:
import xlsxwriter
from docx.api i
zljubi...@gmail.com wrote:
>> You create two stream handlers that both log to stderr -- one with
>> basicConfig() and one explicitly in your code. That's probably not what
>> you want.
>
> How can I just add terminator = '\r\n' to the code bellow?
> Where should I put it?
I already answered that
Chris Angelico wrote:
> Situation: A terminal application. Requirement: Display nicely-wrapped
> text. With colour codes in it. And that text might be indented to any
> depth.
>
> label = f"{indent}\U0010cc32{code}\U0010cc00
> @{tweet['user']['screen_name']}: " wrapper = textwrap.TextWrapper(
>
Chris Angelico wrote:
> On Thu, May 28, 2020 at 5:54 PM Peter Otten <__pete...@web.de> wrote:
>> But at least now you have two -- elegant or gross -- hacks to choose from
>> ;)
>>
>
> Yeah, I thought of this originally as a challenge in redefining the
> con
Buddy Peacock wrote:
> Hello group,
> I have a pretty good background in MySQL & MSSQL as well as VB & Php, but
> I am new to Python and Postgresql.
>
> I am taking a class and working on a project to insert authors and books
> into a table. My code for this is:
> ===
evan.schal...@gmail.com wrote:
> I frequently use binary as bool placeholders and find myself filtering
> lists based on those bools, this seems to have a similar semantic meaning
> as the bit wise ^ or __xor__ operator and could add syntactic sugar to the
> base list class.
>
> Use Case:
>
> Co
Evan Schalton wrote:
> Peter,
>
> This isn't a ram consideration as much it's a logical consideration. There
> are a lot of ways to handle this, I REALLY don't want to use a package
> here. Bit masking is incredibly useful for permutations/combinatoric
> algo
pytho...@gmail.com wrote:
> Hi,
>
> I am struggling with making modules global for all definitions in my code.
Don't. Global names in Python are global to a single module, not your entire
application.
> I faced the problem with the pyomo modules but can generate the error with
> pandas too.
>
Aaron wrote:
> When creating a nested dictionary of dataframes, how can I name a
> dictionary based on a list name of the dataframe?
>
> Given the following:
>
> # START CODE
> import pandas as pd
>
> cars = {'Brand': ['Honda Civic','Toyota Corolla'],
> 'Price': [22000,25000]
>
Antoon Pardon wrote:
> The problem I face is that at the building face, I need a defaultdict
> because the values are lists that are appended too. So a
> defaultdict(list) is convenient in that new entries are treated as if
> the value is an empty list.
>
> However later when I actually use it, a
zljubi...@gmail.com wrote:
> Hi,
>
> consider this example:
>
> from typing import Dict, List
>
>
> class chk_params:
> def execute(self, params: Dict[str, List] = None):
> if params is None:
> params = {}
>
> for k, v in params.items():
> params[k]
emagnun wrote:
> I have a very simple script that retrieves the value from a text box upon
> click of a checkButton. But in click event, I'm receiving text box object
> as NoneType even after setting it as global. Pls help.
>
> Output: !!ERROR!! Tag is None
>
> ### Source Code ##
Ivan Ivanyuk wrote:
> Hello All,
>
> I have some trouble using @dataclass together with @property decorator
> or property() function.
>
> From the documentation and PEP is seems that the intended behaviour of
> @dataclass is to be the same as normal __init__() that sets instance
> variables.
>
Ivan Ivanyuk wrote:
> On Thu, 18 Jun 2020 at 11:26, Peter Otten <__pete...@web.de> wrote:
>>
>> Ivan Ivanyuk wrote:
>>
>> > Hello All,
>> >
>> > I have some trouble using @dataclass together with @property decorator
>> > or propert
Bischoop wrote:
> I try to split input numbers, for example: 12 so I cant add them, I
> tried separated split(' ') but it's not working.
> Any ideas how to do this?
>
> *
> numb1,numb2=input("enter 1st and 2nd no ").split()
> Avg=(int(numb1) + int(numb2)) / 2
> print(Avg)
> *
>
> --
> Thanks
To
Unknown wrote:
> Hello,
>
> I am wondering why this code is OK:
>
> class Temperature:
> def __init__(self):
> self.celsius = 0
>
> fahrenheit = property()
>
> @fahrenheit.getter
> def fahrenheit(self):
> return 9/5*self.celsius +32
>
> @fahrenheit.setter
> def f
Boris Dorestand wrote:
> Say we have [1,3,5,7], [2,3], [1,10]. I'd like to generate
>
> [1,2,1]
> [1,2,10]
> [1,3,1]
> [1,3,10]
> [3,2,1]
> [3,2,10]
> [3,3,1]
> [3,3,10]
> [5, ...]
> ...
> [7,3,10]
>
> The number of input lists is variable. The example shows three lists,
Jim wrote:
> linux mint 19.3, python 3.6
>
> I wrote a program to download stock info from yahoo using yfinance. I
> have been running it unchanged for the past 3 months, today it gave an
> error. When looping through a list of stocks the error is random, never
> the same position in the list.
>
hunter.hammond@gmail.com wrote:
> This is a knn algorithm for articles that I have gotten. Then determines
> which category it belongs to. I am not getting very good results :/
[snip too much code;)]
- Shouldn't the word frequency vectors be normalized? I don't see that in
your code. Witho
kyroha...@gmail.com wrote:
> This is another account but I am the op. Why do you mean normalize? Sorry
> I’m new at this.
Take three texts containing the words
covid, vaccine, program, python
Some preparatory imports because I'm using numpy:
>>> from numpy import array
>>> from numpy.linalg im
J Conrado wrote:
>
>
>
>
>
>
>
>
>
>
>
> HI,
>
>
> I have an excel file with several columns, the first day/month,/year and
> hour:
>
>
> Data
> 01/11/2017 00:00
> 01/11/2017 03:00
> 01/11/2017 06:00
> 01/11/2017 09:00
> 01/11/2017 12:00
> 01/11/2017 15:00
> 01/11/2017 18:00
> 01/11
nd
second, with this design, iterators are required to be iterables too, which
is confusing as hell (at least for people coming from other languages in
which the distinction is strict).
Thanks,
Peter
--
https://mail.python.org/mailman/listinfo/python-list
ethod.
But I think I'm getting off-topic...
Again, thanks guys, @Terry and @dn for your explanations, you've made the
situation clear.
Peter
--
https://mail.python.org/mailman/listinfo/python-list
Just ignore the first few introductory paragraphs... probably jump to the
article starting with *"So, after this long detour about built-ins vs.
keywords, back to None."*
Hope this helps,
Peter
On Wed, Jul 22, 2020 at 3:06 AM Tim Chase
wrote:
> I know for ints, cpython caches someth
if new_page(): print(hdr)
>
Yes, @Terry had given the same example. Frankly, I didn't know about it
before, I somehow had the misconception that for always got a 'fresh'
iterator...
Peter
--
https://mail.python.org/mailman/listinfo/python-list
Chris Green wrote:
> I am getting the following warning from a program I have just
> converted from gtk 2 to gtk 3 :-
>
> (abook:58240): Gtk-WARNING **: 12:01:58.064: Theme parsing error:
> gtk.css:66:28: The :prelight pseudo-class is deprecated. Use :hover
> instead.
>
> How do I find what is c
o1bigtenor wrote:
import calendar
print (calendar.calendar(2024,1,1,2,8))
> I would like to show something like 2024 through the end of 2028.
print("\n".join(cd.calendar(year) for year in range(2024, 2029)))
--
https://mail.python.org/mailman/listinfo/python-list
Richard Damon wrote:
> I would likely just build the formatter to start by assuming 6 week
> months, and then near the end, after stacking the side by side months,
> see if it can be trimmed out (easier to remove at the end then add if
> needed)
If you like some itertools gymnastics: you can form
Chris Angelico wrote:
> On Sat, Aug 15, 2020 at 3:36 PM Manfred Lotz wrote:
>>
>> I have an object which I could initialize providind an int or a str.
>>
>> I am not sure which of the following is best to use
>> - try/except
>> - if type(int)...
>> - if isinstance(v, int)
>>
>> Here a minimal
Steve wrote:
> def makeform(root, fields):
>entries = {}
>for field in fields:
...
>return entries
>
> if __name__ == '__main__':
>root = Tk()
>ents = makeform(root, fields)
>
> SR = (entries['Sensor_Reading'].get())
> print ("SR Outside = " + SR)
>
> ==
Steve wrote:
> I take it that "fetch" is not an inside command or reserved word. The
> code is everything what was posted.
You don't say where you "found" the code. If you took it from
https://www.python-course.eu/tkinter_entry_widgets.php
you need to take another look. A fetch() function is
Chris Green wrote:
>> >1 - Why doesn't it error in Python 2?
>>
>> The dict internal implementation has changed. I don't know the
>> specifics, but it is now faster and maybe smaller and also now preserves
>> insert order.
>>
> Ah, that probably explains it then.
But if you try to modify a dict
Stefan Ram wrote:
> I'm not sure I understand "filterwarnings" correctly.
> It does not suppress the warning within the "with" statement below.
> Outside of the "with" statement, it does work, but according
> to sources it also should work within the "with" statement.
>
> Console transc
Samuel Marks wrote:
> The main thing I want is type safety. I want Python to complain if the
> callee uses the wrong argument types, and to provide suggestions on
> what's needed and info about it.
>
> Without a base class I can just have docstrings and type annotations
> to achieve that.
>
> Wh
Chris Green wrote:
> To add a little to this, the problem is definitely when I receive a
> message with UTF8 (or at least non-ascci) characters in it. My code
> is basically very simple, the main program reads an E-Mail message
> received from .forward on its standard input and makes it into an m
Shivlal Sharma wrote:
> I have seen this code on one of competative programming site but I didn't
> get it, Why output is 9?
>
> from functools import *
>
> def ADDS(a,b):
> return a+1
> nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
> add = reduce(ADDS, nums)
> print(add)
>
> output: 9
Rewrite the AD
Shivlal Sharma wrote:
> from functools import*
> nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
> add = reduce(lambda a : a + 1, nums)
> print(add)
>
> error: -
> TypeError Traceback (most recent call
> last) in ()
> 1 from functools import*
> 2 nums = [1, 2, 3, 4
Steve wrote:
> Compiles, no syntax errors however, line 82 seems to run only once when
> the FOR loop has completed.
> Why is that? All fields are to contain the specifications, not just the
> last one.
It seems that passing the StringVar to the Entry widget is not sufficient to
keep it alive.
Steve wrote:
> How do I left-justify the information in the labels?
> SVRlabel = ttk.Label(window, text = SpecLine + " "*5)
> SVRlabel.grid(column = 1, row = x)
The text in the labels already is left-justified -- but the labels
themselves are centered inside the grid cells.
Steve wrote:
> #What I cannot seem to do is to pull the adjusted
> #information from the form into variables, or a
> #list/array, so that can be used for the update to the file.
The updated data is in the StringVar-s, which, fortunately, you have
available in a list ;)
So:
> def EditDataByForm
Steve wrote:
> OK, I was closer than I thought.
>
> Two weeks ago, the concept of tkinter and these forms were totally new to
> me
> as well as, about two days ago, python list was totally new too. I
> somehow thought that "window.mainloop()" was supposed to be the last entry
> in the function,
Steve wrote:
> Glutton for punishment, I am looking into designing another .py program.
> I would like to pull two columns of information from Excel but the more I
> look
> into coding on the 'net, the more confusing it looks. I don't understand
> what I need to import or install to get the link
Larry Martell wrote:
> I have a list of tuples, and I want to group them by 3 items (0, 3, 4)
> and then within each group sort the data by a 4th item (6) using a
> sort order from another list. The list is always ordered by the 3
> grouping items.
>From your description I deduced
from itertools
Peter Otten wrote:
> group_key = itemgetter(0, 3, 4)
>
>
> def sort_key(row, lookup={k: i for i, k in enumerate(sort_list)}):
> return lookup[row[6]]
>
>
> result = list(
> chain.from_iterable(
> sorted(group, key=sort_key)
> for
Steve wrote:
> I am not sure how to post the code for my file here, is copy/paste the
> best way?
Yes. Try to paste only the relevant parts, or, if possible, post a small
self-contained example that can be run by the reader without further
editing.
> Is there another? I understand that attachm
Mats Wichmann wrote:
> On 9/7/20 5:01 PM, Driuma Nikita wrote:
>
>
> _list = list(range(50))
> for i, el in enumerate(_list):
> del _list[i]
> print(_list)
>
>
> Don't change the the list while you are iterating over it, it messes up
> the iteration. It's not "randomly
Peter Otten wrote:
> If the list is huge you can also delete in reverse order:
>
> for i in reversed(len(_list)):
Make that reversed(range(len(_list))).
> if discard(_list[i]):
> del _list[i]
Example:
>>> items = ['a', 'b', '
1801 - 1900 of 9322 matches
Mail list logo