Re: creating a csv from information I have printed to screen

2020-05-22 Thread Peter Otten
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

exiting a while loop

2020-05-22 Thread John Yeadon via Python-list
Am I unreasonable in expecting this code to exit when required? # Add up the powers of 2 starting with 2**0 until 2 million is met. n = 1 target = 200 sum = 0 while True: x = 2 ** (n - 1) sum += x print(n, sum) if sum >= target: print("Target met.") exit

Re: exiting a while loop

2020-05-22 Thread Souvik Dutta
No not really. If you use a breakpoint and a debugger you will find out that your code continues till 2 M is met and then stops printing numbers continuously. On Fri, 22 May, 2020, 5:20 pm John Yeadon via Python-list, < python-list@python.org> wrote: > Am I unreasonable in expecting this code to

Re: exiting a while loop

2020-05-22 Thread Larry Martell
On Fri, May 22, 2020 at 7:51 AM John Yeadon via Python-list wrote: > > Am I unreasonable in expecting this code to exit when required? > > > # Add up the powers of 2 starting with 2**0 until 2 million is met. > n = 1 > target = 200 > sum = 0 > > while True: > x = 2 ** (n - 1) > sum +

Re: exiting a while loop

2020-05-22 Thread Peter Otten
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

Re: exiting a while loop

2020-05-22 Thread Dan Sommers
On Friday, May 22, 2020, at 7:49, John Yeadon via Python-list wrote: > Am I unreasonable in expecting this code to exit when required? Yes. :-) > # Add up the powers of 2 starting with 2**0 until 2 million is met. > n = 1 > target = 200 > sum = 0 > > while True: > x = 2 ** (n - 1) >

creating a table within python code

2020-05-22 Thread Buddy Peacock
I'm working on my first python project in CS50W and I am trying to create 2 tables. I am getting the following error when trying to run it: I have included my code below the error message. flask.cli.NoAppException: Failed to find Flask application or factory in module "create_db". Use "FLASK_APP

Re: exiting a while loop

2020-05-22 Thread D'Arcy Cain
On 2020-05-22 7:49 a.m., John Yeadon via Python-list wrote: > Am I unreasonable in expecting this code to exit when required? Yes. > # Add up the powers of 2 starting with 2**0 until 2 million is met. > n = 1 > target = 200 > sum = 0 > > while True: >     x = 2 ** (n - 1) >     sum += x >   

Re: creating a csv from information I have printed to screen

2020-05-22 Thread Peter Otten
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

Re: creating a table within python code

2020-05-22 Thread Souvik Dutta
There will be quotes when doing FLASK_APP="" I think that should solve the problem. On Fri, 22 May, 2020, 5:35 pm Buddy Peacock, wrote: > I'm working on my first python project in CS50W and I am trying to create > 2 tables. > I am getting the following error when trying to run it: I have inclu

Re: PyCharm, how to setup self contained subprojects

2020-05-22 Thread Python
Le 22/05/2020 à 03:41, zljubi...@gmail.com a écrit : Hi, I should provide python code for (Spring) microservice patform. In microservice paradigm, each microservice should do a simple task, so python code beneath it should be very small. As a PyCharm (community) user, I don't know how to set u

Re: creating a table within python code

2020-05-22 Thread Buddy Peacock
Thank you Souvik, but still having issues. I have pasted the command line interaction this time. My prior message is what appeared in the browser. c:\Harvard\project1>SET FLASK_APP="cr

Re: creating a table within python code

2020-05-22 Thread Souvik Dutta
And also you might have to add after the import statements app= Flask(__name__) and app.run() inside the main function On Fri, 22 May, 2020, 8:31 pm Souvik Dutta, wrote: > You might have to add @app.route("/") before the main method. > > On Fri, 22 May, 2020, 7:53 pm Buddy Peacock, > wrote: >

Re: creating a csv from information I have printed to screen

2020-05-22 Thread Ciarán Hudson
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? import requests import csv, sys from bs4 import BeautifulSoup cookies = { 'ApplicationGatewayAffinity': '1d2ad8ab214d1293a4e31bcd161589fa82a54a

Re: creating a table within python code

2020-05-22 Thread Souvik Dutta
You might have to add @app.route("/") before the main method. On Fri, 22 May, 2020, 7:53 pm Buddy Peacock, wrote: > Thank you Souvik, but still having issues. I have pasted the command line > interaction this time. My prior message is what appeared in the browser. > >

Re: Strings: double versus single quotes

2020-05-22 Thread Manfred Lotz
On Tue, 19 May 2020 13:36:54 -0500 Tim Chase wrote: > On 2020-05-19 20:10, Manfred Lotz wrote: > > Hi there, > > I am asking myself if I should preferably use single or double > > quotes for strings? > > I'd say your consistency matters more than which one you choose. > First, thanks to all

Re: creating a table within python code

2020-05-22 Thread Buddy Peacock
Still no go. I even tried using the entire path of the py ap in the SET FLASK_APP command This is my code now after trying your suggestions. === import os from flask import Flask, session from flask_session import Sessio

Re: exiting a while loop

2020-05-22 Thread Grant Edwards
On 2020-05-22, Peter Otten <__pete...@web.de> wrote: > If you want to terminate the script you can use exit. However exit > is a function, and you have to call it > > exit() Actually it's an instance of _sitebuiltins.Quitter not a function. You still have to call it. ;) -- Grant -- https:

Re: Online training June 11, 12: Docker packaging best practices for Python in production

2020-05-22 Thread DL Neil via Python-list
On 23/05/20 3:40 AM, Itamar Turner-Trauring wrote: You’re about to ship your Python application into production using Docker: your images are going to be critical infrastructure. ... *The class will take place on two mornings (US East Coast) on June 11th and 12th. You can **learn more about

Re: exiting a while loop

2020-05-22 Thread DL Neil via Python-list
On 23/05/20 4:31 AM, Grant Edwards wrote: On 2020-05-22, Peter Otten <__pete...@web.de> wrote: If you want to terminate the script you can use exit. However exit is a function, and you have to call it exit() Actually it's an instance of _sitebuiltins.Quitter not a function. You still have

Re: Strings: double versus single quotes

2020-05-22 Thread DL Neil via Python-list
I am asking myself if I should preferably use single or double quotes for strings? ... I agree to the following: 1. Consistency is important. 2. Single quotes are less noisy. 3. Triple double quotes are to be preferred over triple single quotes. ... Of course, this is my subjective result,

Re: Strings: double versus single quotes

2020-05-22 Thread Manfred Lotz
On Sat, 23 May 2020 09:36:13 +1200 DL Neil wrote: > >>> I am asking myself if I should preferably use single or double > >>> quotes for strings? > ... > > > I agree to the following: > > > > 1. Consistency is important. > > 2. Single quotes are less noisy. > > 3. Triple double quotes are to b

Is there some reason that recent Windows 3.6 releases don't included executable nor msi installers?

2020-05-22 Thread Adam Preble
I wanted to update from 3.6.8 on Windows without necessarily moving on to 3.7+ (yet), so I thought I'd try 3.6.9 or 3.6.10. All I see for both are source archives: https://www.python.org/downloads/release/python-369/ https://www.python.org/downloads/release/python-3610/ So, uh, I theoretically