Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread Peter Otten
George R Goffe wrote: > When you run a python program, it appears that stdin, stdout, and stderr > are opened automatically. > > I've been trying to find out how you tell if there's data in stdin (like > when you pipe data to a python program) rather than in a named input file. > It seems like mo

Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread Alan Gauld
On 18/10/14 19:36, George R Goffe wrote: When you run a python program, it appears that stdin, stdout, and stderr are opened automatically. correct. I've been trying to find out how you tell if there's data in stdin Same way you tell if there's data in any file/stream - you read from it.

[Tutor] python draw christman tree using loops

2014-10-19 Thread jarod...@libero.it
Dear All, or improve my understanding o python I would like to learn how to draw simple figures using loops. I start from this code in java: import java.util.Scanner; public class Eserc2_8 { public static void main(String args[]) { Scanner s = new Scanner(System.in); // Altezz

Re: [Tutor] python draw christman tree using loops

2014-10-19 Thread Joel Goldstick
On Sun, Oct 19, 2014 at 7:32 AM, jarod...@libero.it wrote: > > Dear All, > or improve my understanding o python I would like to learn how to draw simple > figures using loops. > I start from this code in java: > import java.util.Scanner; > > public class Eserc2_8 { > public static void main(St

Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread David Rock
* Peter Otten <__pete...@web.de> [2014-10-19 10:05]: > George R Goffe wrote: > > > When you run a python program, it appears that stdin, stdout, and stderr > > are opened automatically. > > > > I've been trying to find out how you tell if there's data in stdin (like > > when you pipe data to a py

[Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread George R Goffe
Hi, Wow. Lots of feedback. REALLY GOOD FEEDBACK! This was my first question to this list. Let me clarify my question. I want to use tst.py as follows: tst.py input-file output-file OR cat data-file | tst.py - output-file OR cat data-file | tst.py output-file tst.py input-file output-file works

Re: [Tutor] python draw christman tree using loops

2014-10-19 Thread Joel Goldstick
On Sun, Oct 19, 2014 at 9:27 AM, jarod...@libero.it wrote: > thanks for the help: > In [60]: for i in range(10): >: for t in range(6-i): >: print " " >: for item in range(i+1): >: print "*" >: > > * > > * > > * > > * > > * > > * > > *

Re: [Tutor] python draw christman tree using loops

2014-10-19 Thread Danny Yoo
In Java, System.out represents the standard output device. In Python, there's a similar value in sys.stdout. https://docs.python.org/2/library/sys.html#sys.stdout In your Python program, you should be able to say: import sys at the beginning of your program, and then use: sys.st

[Tutor] Need help to convert pdf to excel

2014-10-19 Thread AMNA MOHAMMED ALRUHEILI
Hell, My name is Amna and I am totally new to python world with zero experience in programming. I am facing the challenge of converting data from pdf to excel. The data within pdf is numbers separated by space not within a table. I need a help to figure out a code that help me to convert these pdf

Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread Adam Jensen
On 10/18/2014 02:36 PM, George R Goffe wrote: > Hi, > > When you run a python program, it appears that stdin, stdout, and stderr are > opened automatically. > > I've been trying to find out how you tell if there's data in stdin (like when > you pipe data to a python program) rather > than in a

Re: [Tutor] Need help to convert pdf to excel

2014-10-19 Thread Danny Yoo
On Sun, Oct 19, 2014 at 7:27 AM, AMNA MOHAMMED ALRUHEILI wrote: > My name is Amna and I am totally new to python world with zero experience in > programming. I am facing the challenge of converting data from pdf to excel. > The data within pdf is numbers separated by space not within a table. > I

[Tutor] what am I not understanding?

2014-10-19 Thread Clayton Kirkwood
raw_table = (''' a: Asky: Dividend Yield b: Bid d: Dividend per Share b2: Ask (Realtime) r1: Dividend Pay Date b3: Bid (Realtime)q: Ex-Dividend Date p: Previous Close o: Open''') key_name = raw_table.rstrip('\t') print(key_name) a: Asky: Dividend Yie

Re: [Tutor] what am I not understanding?

2014-10-19 Thread Alan Gauld
On 19/10/14 23:26, Clayton Kirkwood wrote: raw_table = (''' a: Asky: Dividend Yield b: Bid d: Dividend per Share b2: Ask (Realtime) r1: Dividend Pay Date ... o: Open’’’) key_name = raw_table.rstrip('\t') rstrip() strips characters from the *right* hand side. When it finds a

Re: [Tutor] what am I not understanding?

2014-10-19 Thread Steven D'Aprano
On Sun, Oct 19, 2014 at 03:26:44PM -0700, Clayton Kirkwood wrote: > raw_table = (''' > a: Asky: Dividend Yield [...] > o: Open''') > key_name = raw_table.rstrip('\t') > print(key_name) [...] > #why is the tab not being removed? How do you know that the raw_table contains tabs rather than space