Hi
I have been toying with json and I particular area where I cannot get the
desired result a list of tuples as my return. The json from the API is way to
long but I don't think it will matter.
.. hitting url
data = r.json()
for item in data["RaceDay"]['Meetings'][0]['Races']:
raceDetails
On Thursday, 21 September 2017 20:31:28 UTC+10, Thomas Jollans wrote:
> On 2017-09-21 12:18, Sayth Renshaw wrote:
> > This is my closest code
> >
> > data = r.json()
> >
> > raceData = []
> >
> > for item in data["RaceDay"]['Meeting
> >
> > Thanks Thomas yes you are right with append. I have tried it but just
> > can't get it yet as append takes only 1 argument and I wish to give it 3.
> >
> You have not showed us what you tried, but you are probably missing a pair
> of brackets.
>
> C:\Users\User>python
> Python 3.6.0 (v
Hi
I have got a successful script setup to rotate through dates and download json
data from the url.
As the api returns 200 whether successful I want to check if the file returned
is not successful.
when a file doesn't exist the api returns
{'RaceDay': None, 'ErrorInfo': {'SystemId': 200, 'Err
Thank you it was data["RaceDay"] that was needed.
ata = r.json()
if data["RaceDay"] is None:
print("Nothing here")
else:
print(data["RaceDay"])
Nothing here
Nothing here
Nothing here
{'MeetingDate': '2017-01-11T00:00:00', .
Thanks
Sayth
--
https://mail.python.org/m
HI
Looking for suggestions around json libraries. with Python. I am looking for
suggestions around a long term solution to store and query json documents
across many files.
I will be accessing an api and downloading approx 20 json files from an api a
week. Having downloaded this year I have ov
On Thursday, 5 October 2017 15:13:43 UTC+11, Sayth Renshaw wrote:
> HI
>
> Looking for suggestions around json libraries. with Python. I am looking for
> suggestions around a long term solution to store and query json documents
> across many files.
>
> I will be
Hi
How do I create a valid file name and directory with pathlib?
When I create it using PurePosixPath I end up with an OSError due to an
obvously invlaid path being created.
import pathlib
for dates in fullUrl:
# print(dates)
time.sleep(0.3)
r = requests.get(dates)
data = r.jso
> > Hi
> >
> > How do I create a valid file name and directory with pathlib?
> >
> > When I create it using PurePosixPath I end up with an OSError due to an
> > obvously invlaid path being created.
>
> You're on Windows. The rules for POSIX paths don't apply to your file
> system, and...
>
> >
Hi
I want to get a result from a largish json api. One section of the json
structure returns lists of data. I am wanting to get each resulting list
returned.
This is my code.
import json
from pprint import pprint
with open(r'/home/sayth/Projects/results/Canterbury_2017-01-20.json', 'rb') as
f
On Sunday, 5 November 2017 09:53:37 UTC+11, Cameron Simpson wrote:
> >I want to get a result from a largish json api. One section of the json
> >structure returns lists of data. I am wanting to get each resulting list
> >returned.
> >
> >This is my code.
> >import json
> >from pprint import ppr
On Sunday, 5 November 2017 04:32:26 UTC+11, Steve D'Aprano wrote:
> I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.
>
>
> import sqlite3
> con = sqlite3.connect('foo.sqlite')
> with open('dump.sql', 'w') as f:
> for line in con.iterdump():
> f.write(line +
> I'd just keep the interesting runners, along with their race numbers, in a
> dict. The enumerate function is handy here. Something like (untested):
>
> runner_lists = {}
> for n, item in enumerate(result):
> if this one is interested/not-filtered:
> runner_lists[n] = result["Raci
Sorry
figured it. Needed to use n to iterate when creating.
runner_lists = {}
for n, item in enumerate(result):
# if this one is interested / not -filtered:
print(n, item)
runner_lists[n] = result[n]["RacingFormGuide"]["Event"]["Runners"]
Sayth
--
https://mail.python
no doubt tho after playing with this is that enumerate value ends up in the
output which is a dictionary. The enumerate has no key which makes it invalid
json if dumped.
Not massive issue but getting the effect of enumerate without polluting output
would be the winner.
>runner_lists = {}
Hi
I want to create a generator function that supplies my calling function a file,
how though do I get the generator to accept attributes in the argument when
called?
This works not as a generator
for filename in sorted(file_list):
with open(dir_path + filename) as fd:
doc = xmlto
> The way I'm reading your code, it's not the generator that's the
> difference here. Consider these lines:
>
> > for item in doc['meeting']['race']:
> >
> > def return_files(file_list):
> > for filename in sorted(file_list, *attribs):
> > for item in doc([attribs]):
>
>
This seems to work as a starter.
def return_files(file_list):
""" Take a list of files and return file when called
Calling function to supply attributes
"""
for filename in sorted(file_list):
with open(dir_path + filename) as fd:
doc = xmltodict.parse(f
Hi
Trying to clarify why ints and strings arent treated the same.
You can get a valuerror from trying to cast a non-int to an int as in int(3.0)
however you cannot do a non string with str(a).
Which means that you likely should use try and except to test if a user enters
a non-int with valuerr
To answer all the good replies.
I adapted a simple vector example from the Springer book practical primer on
science with python.
Having solved the actual problem I thought checking with the user they had the
correct entries or would like to ammend them would be a good addition. This
leads to
This ends being the code I can use to get it to work, seems clear and pythonic,
open to opinion on that :-)
answer = input("\t >> ")
if isinstance(int(answer), int) is True:
raise ValueError("Ints aren't valid input")
sys.exit()
elif isinstance(answer, str) is True:
print(v0 * t
> >
> >> Are there any other data types that will give you type(A) or type(B) =
> >> besides True and False?
> >
> > No types but any variable or expression containing True or False will be
> > a bool type (or class bool):
>
> "Containing" True or False? Certainly not:
>
> py> type( [1, 2, Tr
> > This ends being the code I can use to get it to work, seems clear and
> > pythonic, open to opinion on that :-)
>
> Neither clear, nor Pythonic.
Sadly imo clearer than the many hack attempts on SO.
>
> > answer = input("\t >> ")
>
> Since input() returns a string in Python 3, this will al
I have a list of lists of numbers like this excerpt.
['0', '0', '0', '0']
['0', '0', '0', '0']
['0', '0', '0', '0']
['0', '0', '0', '0']
['0', '0', '0', '0']
['0', '0', '0', '0']
['7', '2', '1', '0', '142647', '00']
['7', '2', '0', '1', '87080', '00']
['6', '1', '1', '1', '51700', '00']
['4', '1',
> > I want to go threw and for each index error at [4] append a 0.
>
> You want to append 0 if the list does not have at least 5 items?
>
> > p = re.compile('\d+')
> > fups = p.findall(nomattr['firstup'])
> > [x[4] for x in fups if IndexError fups.append(0)]
> > print(fups)
>
> > Unsure why I c
On Saturday, 1 October 2016 14:17:06 UTC+10, Rustom Mody wrote:
> On Saturday, October 1, 2016 at 9:08:09 AM UTC+5:30, Sayth Renshaw wrote:
> > I do like [(f + ['0'] if len(f) < 5 else f) for f in fups ] Rustom, if
> > there are better non list comprehension opt
On Saturday, 1 October 2016 14:17:06 UTC+10, Rustom Mody wrote:
> On Saturday, October 1, 2016 at 9:08:09 AM UTC+5:30, Sayth Renshaw wrote:
> > I do like [(f + ['0'] if len(f) < 5 else f) for f in fups ] Rustom, if
> > there are better non list comprehension opt
Evening
My file list handler I have created a generator.
Before I created it as a generator I was able to use iter on my lxml root
objects, now I cannot iter.
± |master U:2 ?:1 ✗| → python3 race.py data/ -e *.xml
Traceback (most recent call last):
File "race.py", line 83, in
dataAttr(roo
On Saturday, 1 October 2016 08:59:28 UTC+10, Irmen de Jong wrote:
> Hi,
>
> I've made a very simple rocket simulation game, inspired by the recent
> success of SpaceX
> where they managed to land the Falcon-9 rocket back on a platform.
>
> I was curious if you can make a simple graphics animati
My main issue is that usually its just x in ,,, for a generator.
But if I change the code
for meet in roots.iter("meeting"):
to
for meet in roots("meeting"):
Well its invalid but I need to be able to reference the node, how do I achieve
this?
Sayth
--
https://mail.python.org/mailman/listinfo/
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.
Loving life.
I first started with a simple with open on a file, which allowed me to use code
that "iter"'s.
for example:
for meet in root.iter("meeting"):
for race in root.ite
On Sunday, 2 October 2016 04:52:13 UTC+11, Xristos Xristoou wrote:
> hello team
>
> i want to calculate slope and aspect from some RASTER
> IMAGE(.grid,tiff,geotiff)
> who is the better method to can i do this ?
> with numpy and scipy or with some package?
>
>
> thnx you team
I don't know muc
Hi
I have a fileobject which was fine however now I want to delete a line from the
file object before yielding.
def return_files(file_list):
for filename in sorted(file_list):
with open(dir_path + filename) as fd:
for fileItem in fd:
yield fileItem
Ned
Thank you
--
https://mail.python.org/mailman/listinfo/python-list
On Sunday, 2 October 2016 12:14:43 UTC+11, MRAB wrote:
> On 2016-10-02 01:21, Sayth Renshaw wrote:
> > Hi
> >
> > I have a fileobject which was fine however now I want to delete a line from
> > the file object before yielding.
> >
> > def return_files(fil
On Sunday, 2 October 2016 16:19:14 UTC+11, Sayth Renshaw wrote:
> On Sunday, 2 October 2016 12:14:43 UTC+11, MRAB wrote:
> > On 2016-10-02 01:21, Sayth Renshaw wrote:
> > > Hi
> > >
> > > I have a fileobject which was fine however now I want to delete a lin
Is there a standard library feature that allows you to define a declarative map
or statement that defines the data and its objects to be parsed and output
format?
Just wondering as for loops are good but when i end up 3-4 for loops deep and
want multiple matches at each level i am finding it ha
I would ask on scipy mailing list as it may provide a better response.
https://www.scipy.org/scipylib/mailing-lists.html
Sayth
--
https://mail.python.org/mailman/listinfo/python-list
I am following John Shipmans example from
http://infohost.nmt.edu/~shipman/soft/pylxml/web/Element-getchildren.html
>>> xml = '''
... '''
>>> pen = etree.fromstring(xml)
>>> penContents = pen.getchildren()
>>> for content in penContents:
... print "%-10s %3s" % (content.tag, content.get("n"
I was solving a problem to create a generator comprehension with 'Got ' and a
number for each in range 10.
This I did however I also get a list of None. I don't understand where none
comes from. Can you please clarify?
a = (print("Got {0}".format(num[0])) for num in enumerate(range(10)))
# for
Thank you quite easy, was trying to work around it in the generator, the print
needs to be outside the generator to avoid the collection of "None".
Wasn't really liking comprehensions though python 3 dict comprehensions are a
really nice utility.
Sayth
--
https://mail.python.org/mailman/listi
>
> > Hello guys. so my assignment consists in creating a key generator so i can
> > use it in later steps of my work. In my first step i have to write a
> > function called key_generator that receives an argument, letters, that
> > consists in a tuple of 25 caracters. The function returns a t
If shuffle is an "in place" function and returns none how do i obtain the
values from it.
from random import shuffle
a = [1,2,3,4,5]
b = shuffle(a)
print(b[:3])
For example here i just want to slice the first 3 numbers which should be
shuffled. However you can't slice a noneType object that b
So why can't i assign the result slice to a variable b?
It just keeps getting none.
Sayth
--
https://mail.python.org/mailman/listinfo/python-list
Ok i think i do understand it. I searched the python document for in-place
functions but couldn't find a specific reference.
Is there a particular part in docs or blog that covers it? Or is it fundamental
to all so not explicitly treated in one particular page?
Thanks
Sayth
--
https://mail.
Hi Chris
I read this last night and thought i may have woken with a frightfully witty
response.
I didnt however.
Thanks :-)
--
https://mail.python.org/mailman/listinfo/python-list
On Thursday, 20 October 2016 20:51:56 UTC+11, Tony van der Hoff wrote:
> For a long time, under Python 2.7, I have been using htmltmpl to
> generate htmjl pages programmatically from Python.
>
> However, htmltmpl is not available for python3, and doesn't look as if
> it ever will be. Can anyone r
Hi
I have been trying to get a script to work on windows that works on mint. The
key blocker has been utf8 errors, most of which I have solved.
Now however the last error I am trying to overcome, the solution appears to be
to use the .decode('windows-1252') to correct an ascii error.
I am usi
Possibly i will have to use a different method from lxml like this.
http://stackoverflow.com/a/29057244/461887
Sayth
--
https://mail.python.org/mailman/listinfo/python-list
On Tuesday, 20 December 2016 22:54:03 UTC+11, Sayth Renshaw wrote:
> Hi
>
> I have been trying to get a script to work on windows that works on mint. The
> key blocker has been utf8 errors, most of which I have solved.
>
> Now however the last error I am trying to over
Hi
I am looping a list of files and want to skip any empty files.
I get an error that str is not an iterator which I sought of understand but
can't see a workaround for.
How do I make this an iterator so I can use next on the file if my test returns
true.
Currently my code is.
for dir_path, s
Ah yes. Thanks ChrisA
http://www.tutorialspoint.com/python/python_loop_control.htm
The continue Statement:
The continue statement in Python returns the control to the beginning of the
while loop. The continue statement rejects all the remaining statements in the
current iteration of the loop an
Hi
This is simple, but its getting me confused.
I have a csv writer that opens a file and loops each line of the file for each
file and then closes, writing one file.
I want to alter the behaviour to be a written file for each input file. I saw a
roundrobin example however it failed for me as
So can I call the generator twice and receive the same file twice in 2 for
loops?
Once to get the files name and the second to process?
for file in rootobs:
base = os.path.basename(file.name)
write_to = os.path.join("output", os.path.splitext(base)[0] + ".csv")
with o
On Wednesday, 4 January 2017 12:36:10 UTC+11, Sayth Renshaw wrote:
> So can I call the generator twice and receive the same file twice in 2 for
> loops?
>
> Once to get the files name and the second to process?
>
> for file in rootobs:
> base = os.pa
Untested as i wrote this in notepad at work but, if i first use the generator
to create a set of filenames and then iterate it then call the generator anew
to process file may work?
Good idea or better available?
def get_list_of_names(generator_arg):
name_set = set()
for name in generat
For completeness I was close this is the working code.
def get_list_of_names(generator_arg):
name_set = set()
for name in generator_arg:
base = os.path.basename(name.name)
filename = os.path.splitext(base)[0]
name_set.add(filename)
return name_set
def data_att
Afternoon
Is there a good library or way I could use to check that the author of the XML
doc I am using doesn't make small changes to structure over releases?
Not fully over this with XML but thought that XSD may be what I need, if I
search "python XSD" I get a main result for PyXB and generate
It definitely has more features than i knew http://xmlsoft.org/xmllint.html
Essentially thigh it appears to be aimed at checking validity and compliance of
xml.
I why to check the structure of 1 xml file against the previous known structure
to ensure there are no changes.
Cheers
Sayth
--
http
On Wednesday, 4 January 2017 12:36:10 UTC+11, Sayth Renshaw wrote:
> So can I call the generator twice and receive the same file twice in 2 for
loops?
>
> Once to get the files name and the second to process?
>
> for file in rootobs:
> base = os.path.
So can I call the generator twice and receive the same file twice in 2 for
loops?
Once to get the files name and the second to process?
for file in rootobs:
base = os.path.basename(file.name)
write_to = os.path.join("output", os.path.splitext(base)[0] + ".csv")
with open
Untested as i wrote this in notepad at work but, if i first use the generator
to create a set of filenames and then iterate it then call the generator anew
to process file may work?
Good idea or better available?
def get_list_of_names(generator_arg):
name_set = set()
for name in generat
For completeness I was close this is the working code.
def get_list_of_names(generator_arg):
name_set = set()
for name in generator_arg:
base = os.path.basename(name.name)
filename = os.path.splitext(base)[0]
name_set.add(filename)
return name_set
def data_att
Afternoon
Is there a good library or way I could use to check that the author of the XML
doc I am using doesn't make small changes to structure over releases?
Not fully over this with XML but thought that XSD may be what I need, if I
search "python XSD" I get a main result for PyXB and generate
On Thursday, 26 April 2018 07:57:28 UTC+10, Paul Rubin wrote:
> Sayth Renshaw writes:
> > What I am trying to figure out is how I give myself surety that the
> > data I parse out is correct or will fail in an expected way.
>
> JSON is messier than people think. Here
I have data which is a list of lists of all the full paths in a json document.
How can I change the format to be usable when selecting elements?
data = [['glossary'],
['glossary', 'title'],
['glossary', 'GlossDiv'],
['glossary', 'GlossDiv', 'title'],
['glossary', 'GlossDiv', 'GlossList'],
['
> >
> > for item in data:
> > for elem in item:
> > out = ("[{0}]").format(elem)
> > print(out)
>
> Hint: print implicitly adds a newline to the output string. So collect all
> the values of each sublist and print a line-at-time to output, or use the
> end= argument of Py3's p
I am very close to the end result. I now have it as
Output
[ ['[glossary]'],
['[glossary]', '[title]'],
['[glossary]', '[GlossDiv]'],
['[glossary]', '[GlossDiv]', '[title]'],
['[glossary]', '[GlossDiv]', '[GlossList]'],
['[glossary]', '[GlossDiv]', '[GlossList]', '[GlossEntry
On Tuesday, 24 July 2018 14:25:48 UTC+10, Rick Johnson wrote:
> Sayth Renshaw wrote:
>
> > elements = [['[{0}]'.format(element) for element in elements]for elements
> > in data]
>
> I would suggest you avoid list comprehensions until you master long-form
&g
On Tuesday, 24 July 2018 14:25:48 UTC+10, Rick Johnson wrote:
> Sayth Renshaw wrote:
>
> > elements = [['[{0}]'.format(element) for element in elements]for elements
> > in data]
>
> I would suggest you avoid list comprehensions until you master long-form
&g
> myjson = ...
> path = "['foo']['bar'][42]"
> print(eval("myjson" + path))
>
> ?
>
> Wouldn't it be better to keep 'data' as is and use a helper function like
>
> def get_value(myjson, path):
> for key_or_index in path:
> myjson = myjson[key_or_index]
> return myjson
>
> path
> > Then using this cool answer on SO [...]
>
> Oh. I thought you wanted to learn how to solve problems. I had no idea you
> were auditioning for the James Dean part. My bad.
Awesome response burn lol.
I am trying to solve problems. Getting tired of dealing with JSON and having to
figure out
>
> Well, your code was close. All you needed was a little tweak
> to make it work like you requested. So keep working at it,
> and if you have a specific question, feel free to ask on the
> list.
>
> Here's a tip. Try to simplify the problem. Instead of
> looping over a list of lists, and then a
Hi.
I want to use a function argument as an argument to a bs4 search for attributes.
I had this working not as a function
# noms = soup.findAll('nomination')
# nom_attrs = []
# for attr in soup.nomination.attrs:
# nom_attrs.append(attr)
But as I wanted to keep finding other ele
Thanks Peter
###
(2) attrs is a dict, so iterating over it will lose the values. Are you sure
you want that?
###
Yes initially I want just the keys as a list so I can choose to filter them out
to only the ones I want.
# getAttr
Thanks very much will get my function up and working.
Cheers
Hi
Looking at the wiki list of build tools
https://wiki.python.org/moin/ConfigurationAndBuildTools
Has anyone much experience in build tools as i have no preference or experience
to lean on.
Off descriptions only i would choose invoke.
My requirements, simply i want to learn and build a simple
Win 10 will have full bash provided by project between Ubuntu and MS so that's
pretty cool
Sayth
--
https://mail.python.org/mailman/listinfo/python-list
On Tuesday, 12 April 2016 19:48:43 UTC+10, Sayth Renshaw wrote:
> Hi
>
> Looking at the wiki list of build tools
> https://wiki.python.org/moin/ConfigurationAndBuildTools
>
> Has anyone much experience in build tools as i have no preference or
> experience to lean on.
so much clearer.
Anyway checked out mako which has some improvement might see if there is
another with support and create a nikola plugin and then give it a try.
Cheers
Sayth
On Thu, 14 Apr 2016 1:19 am Chris Warrick wrote:
> On 12 April 2016 at 11:48, Sayth Renshaw wrote:
>
Hi
Wondering if someone has this knowledge, and please forgive my maths
expressions.
If I want to estimate need results to achieve a goal at the end of a term
updated weekly with real results how would I structure this?
So as an example to illustrate my thought process(which could be wrong) The
Hi
I have an XML and using pyquery to obtain the elements within it and then write
it to csv.
What is the best most reliable way to take dictionaries of each element, and
print them(csv write later) based on each position so get item 0 of each list
and then it 1 and so on.
Any other code I po
On Monday, 18 April 2016 12:05:39 UTC+10, Sayth Renshaw wrote:
> Hi
>
> I have an XML and using pyquery to obtain the elements within it and then
> write it to csv.
>
> What is the best most reliable way to take dictionaries of each element, and
> print them(csv write
On Monday, 18 April 2016 12:12:59 UTC+10, Sayth Renshaw wrote:
> On Monday, 18 April 2016 12:05:39 UTC+10, Sayth Renshaw wrote:
> > Hi
> >
> > I have an XML and using pyquery to obtain the elements within it and then
> > write it to csv.
> >
> > Wha
On Monday, 18 April 2016 13:13:21 UTC+10, Sayth Renshaw wrote:
> On Monday, 18 April 2016 12:12:59 UTC+10, Sayth Renshaw wrote:
> > On Monday, 18 April 2016 12:05:39 UTC+10, Sayth Renshaw wrote:
> > > Hi
> > >
> > > I have an XML and using pyquery to ob
On Monday, 18 April 2016 13:53:30 UTC+10, Xristos Xristoou wrote:
> guys i have big proplem i want to install scipy
> but all time show me error
> i have python 2.7 and windows 10
> i try to use pip install scipy and i take that error
>
> raise NotFoundError('no lapack/blas resources found')
>
On Monday, 18 April 2016 13:53:30 UTC+10, Xristos Xristoou wrote:
> guys i have big proplem i want to install scipy
> but all time show me error
> i have python 2.7 and windows 10
> i try to use pip install scipy and i take that error
>
> raise NotFoundError('no lapack/blas resources found')
>
>
> You're getting very chatty with yourself, which is fine... but do you
> need to quote your entire previous message every time? We really don't
> need another copy of your XML file in every post.
>
> Thanks!
>
> ChrisA
Oops sorry, everytime I posted I then thought of another resource and ke
Hi
If you are parsing files in a directory what is the best way to record which
files were actioned?
So that if i re-parse the directory i only parse the new files in the
directory?
Thanks
Sayth
--
https://mail.python.org/mailman/listinfo/python-list
Thank you Martin and Peter
To clarify Peter at the moment only writing to csv but am wanting to set up an
item pipeline to SQL db next.
I will have a go at your examples Martin and see how i go.
Thank you both for taking time to help.
Sayth
--
https://mail.python.org/mailman/listinfo/python-l
Hi
Why would it be that my files are not being found in this script?
from pyquery import PyQuery as pq
import pandas as pd
import os
import sys
if len(sys.argv) == 2:
print("no params")
sys.exit(1)
dir = sys.argv[1]
mask = sys.argv[2]
files = os.listdir(dir)
fileResult = filter(lambda
On Tuesday, 19 April 2016 18:17:02 UTC+10, Peter Otten wrote:
> Steven D'Aprano wrote:
>
> > On Tue, 19 Apr 2016 09:44 am, Sayth Renshaw wrote:
> >
> >> Hi
> >>
> >> Why would it be that my files are not being found in this script?
> &g
On Tuesday, 19 April 2016 23:21:42 UTC+10, Sayth Renshaw wrote:
> On Tuesday, 19 April 2016 18:17:02 UTC+10, Peter Otten wrote:
> > Steven D'Aprano wrote:
> >
> > > On Tue, 19 Apr 2016 09:44 am, Sayth Renshaw wrote:
> > >
> > >> Hi
> >
On Tuesday, 19 April 2016 23:46:01 UTC+10, Peter Otten wrote:
> Sayth Renshaw wrote:
>
> > Thanks for the insight, after doing a little reading I found this post
> > which uses both argparse and glob and attempts to cover the windows and
> > bash expansio
Hi
This file contains my biggest roadblock with programming and that's the
abstract nature of needing to pass data from one thing to the next.
In my file here I needed to traverse and modify the XML file I don't want to
restore it or put it in a new variable or other format I just want to alter
>
> Your actual problem is drowned in too much source code. Can you restate it
> in English, optionally with a few small snippets of Python?
>
> It is not even clear what the code you provide should accomplish once it's
> running as desired.
>
> To give at least one code-related advice: You
On Friday, 29 April 2016 01:19:28 UTC+10, Dan Strohl wrote:
> If I am reading this correctly... you have something like (you will have to
> excuse my lack of knowledge about what kinds of information these actually
> are):
>
>
> 1234
> first
>
>
> 5678
> second
>
>
>
> And
On Friday, 29 April 2016 09:56:13 UTC+10, David Shi wrote:
> Hello, Matt,
> Please see the web link.Pandas Pivot Table Explained
>
> | |
> | | | | | |
> | Pandas Pivot Table ExplainedExplanation of pandas pivot_table function. |
> | |
> | View on pbpython.com | Preview by Yahoo |
> |
> because a set avoids duplicates. If you say "I want to document my
> achievements for posterity" I would recommend that you print to a file
> rather than append to a list and the original code could be changed to
>
> with open("somefile") as f:
> for achievement in my_achievements:
>
Looking at various Python implementations of Conway's game of life.
I came across one on rosetta using defaultdict.
http://rosettacode.org/wiki/Conway%27s_Game_of_Life#Python
Just looking for your opinion on style would you write it like this continually
calling range or would you use enumerate
Also not using enumerate but no ugly for i range implementation
this one from code review uses a generator on live cells only.
http://codereview.stackexchange.com/a/108121/104381
def neighbors(cell):
x, y = cell
yield x - 1, y - 1
yield x, y - 1
yield x + 1, y - 1
yield
1 - 100 of 236 matches
Mail list logo