Re: [Linux-programlama] Python Programlama:Paremetre Ekleme:Nasıl?

---------

New Message Reply About this list Date view Thread view Subject view Author view Attachment view

From: Buğrahan Korkmaz (kickboksor@gmail.com)
Date: Mon 19 Jun 2006 - 12:26:03 GMT


Teşekkürler...

(Listeyi teşekkür için meşgul etmek ne kadar doğru bilmiyorum...)

2006/6/19, Burak Çelebi <burakcelebi@gmail.com>:
>
> On 6/19/06, Buğrahan Korkmaz <kickboksor@gmail.com> wrote:
> > Ya tekrar rahatsız ediyorum ama eğer vaktiniz ve sabrınız varsa ufak bir
> > python betiği yazar mısınız paremetreyle ilgili. Halaa anlamış değilim.
> > Örneğin:
> >
> > program.py --test denildiğinde merhaba desin
> > program.py -go denildiğinde gülegüle desin...
> >
> > 2006/6/19, Buğrahan Korkmaz <kickboksor@gmail.com>:
> > >
> > > Teşekkür ederim...
>
>
> import sys
>
> args = sys.argv
>
> if args[1] == 'test':
> print 'merhaba'
> elif args[1] == 'go':
> print 'gule gule'
>
> kullanim:
> python test.py test
> python test.py go
>
> Basit scriptler icin bu isinizi gorur. Ancak kisa/uzun "flag" (-test,
> --test) kullanmak isterseniz bunlara bakmalisiniz:
> http://diveintopython.org/scripts_and_streams/command_line_arguments.html
> http://docs.python.org/lib/module-getopt.html
> http://docs.python.org/lib/module-optparse.html
>
> Iyi calismalar.
>
> > >
> > >
> > > 2006/6/19, Burak Çelebi < burakcelebi@gmail.com>:
> > >
> > > >
> > >
> > > Bunlara da bakmak isteyebilirsiniz:
> > >
> > > http://docs.python.org/lib/module-getopt.html
> > > http://docs.python.org/lib/module-optparse.html
> > >
> > > On 6/19/06, Burak Çelebi <burakcelebi@gmail.com> wrote:
> > > > On 6/19/06, Burak Çelebi < burakcelebi@gmail.com> wrote:
> > > > > sys.argv stringlerden olusan liste donduruyor:
> > > > >
> > > > > ornegin,
> > > > > python test.py 5 mest
> > > > >
> > > > > icin
> > > > > ['/home/burak/arg.py', '5', 'mest'] listesi doner. Burada 5'i int
> > > >
> > > > Pardon dogrusu:
> > > > ['/home/burak/test.py', '5', 'mest'] olacak.
> > > >
> > > > > olarak kullanmak icin string'ten int'e donusturmemiz gerek. 'mest'
> i
> > > > > ise dogrudan kullanabiliriz.
> > > > >
> > > > > import sys
> > > > >
> > > > > args = sys.argv
> > > > >
> > > > > print 4 + int(args[1])
> > > > > print args[2]
> > > > >
> > > > >
> > > > > On 6/19/06, Buğrahan Korkmaz < kickboksor@gmail.com> wrote:
> > > > > > Lütfen, anlayamadım. Bir daha anlatır mısınız?
> > > > > >
> > > > > > Sys'yi import ettik. Tamam ondan sonrasını da anladım ama nasıl
> > > > > > kullanabileceğimi bilmiyorum. Biraz daha açın...
> > > > > >
> > > > > > 2006/6/19, Burak Çelebi < burakcelebi@gmail.com>:
> > > > > > >
> > > > > > Merhaba,
> > > > > >
> > > > > > On 6/19/06, Buğrahan Korkmaz <kickboksor@gmail.com > wrote:
> > > > > > > Merhabalar,
> > > > > > >
> > > > > > > Arkadaşlar ben python programlama dili üzerinde çalışıyorum.
> > Birşeyi
> > > > > > > yapamıyorum. Mesela konsol uygulamaları paremetre kullanır.
> Her
> > > > > > paremetrede
> > > > > > > çeşitli görevler yaparlar. Ben de konsolda pythonla
> programlama
> > yaptığım
> > > > > > > için bunu öğrenmem lazım. Evet, nasıl paremetre ekleyebilirim?
> > > > > >
> > > > > > import sys
> > > > > >
> > > > > > args = sys.argv
> > > > > > print args[0]
> > > > > > print args[1]
> > > > > > ...
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Burak Celebi - http://www.burakcelebi.tk
> > > > > >
> > > > > > _______________________________________________
> > > > > > Linux-programlama mailing list
> > > > > > Linux-programlama@liste.linux.org.tr
> > > > > >
> > http://liste.linux.org.tr/mailman/listinfo/linux-programlama
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Buğrahan Korkmaz
> > > > > > _______________________________________________
> > > > > > Linux-programlama mailing list
> > > > > > Linux-programlama@liste.linux.org.tr
> > > > > >
> > http://liste.linux.org.tr/mailman/listinfo/linux-programlama
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Burak Celebi - http://www.burakcelebi.tk
> > > > >
> > > >
> > > >
> > > > --
> > > > Burak Celebi - http://www.burakcelebi.tk
> > > > Jerry: But the question is, are you still master of your domain?
> > > >
> > >
> > >
> > > --
> > > Burak Celebi - http://www.burakcelebi.tk
> > >
> > >
> > > _______________________________________________
> > >
> > > Linux-programlama mailing list
> > > Linux-programlama@liste.linux.org.tr
> > >
> > http://liste.linux.org.tr/mailman/listinfo/linux-programlama
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > >
> > > Buğrahan Korkmaz
> >
> >
> >
> > --
> > Buğrahan Korkmaz
> > _______________________________________________
> > Linux-programlama mailing list
> > Linux-programlama@liste.linux.org.tr
> > http://liste.linux.org.tr/mailman/listinfo/linux-programlama
> >
> >
> >
>
>
> --
> Burak Celebi - http://www.burakcelebi.tk
>
> _______________________________________________
> Linux-programlama mailing list
> Linux-programlama@liste.linux.org.tr
> http://liste.linux.org.tr/mailman/listinfo/linux-programlama
>
>
>

-- 
Buğrahan Korkmaz

_______________________________________________
Linux-programlama mailing list
Linux-programlama@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama


New Message Reply About this list Date view Thread view Subject view Author view Attachment view

---------

Bu arsiv hypermail 2.1.2 tarafindan uretilmistir.