Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Kako da uradim ovo u Pythonu?

[es] :: Python :: Kako da uradim ovo u Pythonu?

[ Pregleda: 9718 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

wraith46

Član broj: 336363
Poruke: 29



+1 Profil

icon Kako da uradim ovo u Pythonu?16.04.2017. u 14:05 - pre 52 meseci
Code:
if (words.Find(x => x.WordOrPhrase == w.WordOrPhrase) == null)


words je list
 
Odgovor na temu

wraith46

Član broj: 336363
Poruke: 29



+1 Profil

icon Re: Kako da uradim ovo u Pythonu?16.04.2017. u 23:07 - pre 52 meseci
Code:
if not any(x for x in self.words if x.wordorphrase == w.wordorphrase):
 
Odgovor na temu

nenad.bjelic
Nenad Bjelic

Član broj: 311866
Poruke: 2
92.244.132.*



Profil

icon Re: Kako da uradim ovo u Pythonu?26.04.2019. u 22:25 - pre 27 meseci

Sta zeza u ovom kodu da nece da racuna konvertovanje iz dinara u eure??? Gde gresim?



CODE:

from tkinter import *
def promeni():
unos=int(entry.get())
unos=unos/120
output_label.configure(text = 'Konvertovano u euro: {:.1f}'.format(unos))
entry.delete(0,END)
root = Tk()
message_label = Label(text='Unesite vrednost u RSD',font=('Verdana', 16))
output_label = Label(font=('Verdana', 16))
entry = Entry(font=('Verdana', 16), width=4)
calc_button = Button(text='Promeni', font=('Verdana', 16),command=promeni)
message_label.grid(row=0, column=0)
entry.grid(row=0, column=1)
calc_button.grid(row=0, column=2)
output_label.grid(row=1, column=0, columnspan=3)

def konvertuj():
iznos=int(entry.get())
iznos=iznos*120
output_label.configure(text = 'Konvertovano u RSD: {:.1f}'.format(iznos))
entry.delete(0,END)
message_label = Label(text='Unesite vrednost u euro',font=('Verdana', 16))
output_label = Label(font=('Verdana', 16))
entry = Entry(font=('Verdana', 16), width=4)
calc_button = Button(text='Konvertuj', font=('Verdana', 16),command=konvertuj)
message_label.grid(row=2, column=0)
entry.grid(row=2, column=1)
calc_button.grid(row=2, column=2)
output_label.grid(row=3, column=0, columnspan=3)
mainloop()
 
Odgovor na temu

Panta_
Aleksandar Pantić
Kragujevac

Član broj: 214959
Poruke: 721



+126 Profil

icon Re: Kako da uradim ovo u Pythonu?01.05.2019. u 12:15 - pre 27 meseci
Izmeni ovo drugo entry u entry2:

Code (python):

from tkinter import *

def promeni():
    unos=int(entry.get())
    unos=unos/120

    output_label.configure(text = 'Konvertovano u euro: {:.1f}'.format(unos))
    entry.delete(0,END)

root = Tk()
message_label = Label(text='Unesite vrednost u RSD',font=('Verdana', 16))
output_label = Label(font=('Verdana', 16))
entry = Entry(font=('Verdana', 16), width=4)
calc_button = Button(text='Promeni', font=('Verdana', 16),command=promeni)
message_label.grid(row=0, column=0)
entry.grid(row=0, column=1)
calc_button.grid(row=0, column=2)
output_label.grid(row=1, column=0, columnspan=3)

def konvertuj():
    iznos=int(entry2.get())
    iznos=iznos*120
    output_label.configure(text = 'Konvertovano u RSD: {:.1f}'.format(iznos))
    entry2.delete(0,END)

message_label = Label(text='Unesite vrednost u euro',font=('Verdana', 16))
output_label = Label(font=('Verdana', 16))
entry2 = Entry(font=('Verdana', 16), width=4)
calc_button = Button(text='Konvertuj', font=('Verdana', 16),command=konvertuj)
message_label.grid(row=2, column=0)
entry2.grid(row=2, column=1)
calc_button.grid(row=2, column=2)
output_label.grid(row=3, column=0, columnspan=3)

mainloop()


Inace, evro nije 120 ;). Mozes sa ovog sajta da preuzmes kursnu listu. Na primer:

Code (python):

from requests_xml import XMLSession

url = 'https://api.kursna-lista.info/...a0ac413c7ee76/kursna_lista/xml'
session = XMLSession()
r = session.get(url)
kurs = r.xml.find('valuta', first=True).attrs['pro']
print(kurs)
118.3086


Instaliraj requests-xml sa pip install requests-xml.

Code (python):

from tkinter import *

from requests_xml import XMLSession

url = 'https://api.kursna-lista.info/...a0ac413c7ee76/kursna_lista/xml'
session = XMLSession()
r = session.get(url)
kurs = r.xml.find('valuta', first=True).attrs['pro']


def promeni():
    unos=int(entry.get())
    unos=unos/float(kurs)

    output_label.configure(text = 'Konvertovano u euro: {:.1f}'.format(unos))
    entry.delete(0,END)

root = Tk()
message_label = Label(text='Unesite vrednost u RSD',font=('Verdana', 16))
output_label = Label(font=('Verdana', 16))
entry = Entry(font=('Verdana', 16), width=4)
calc_button = Button(text='Promeni', font=('Verdana', 16),command=promeni)
message_label.grid(row=0, column=0)
entry.grid(row=0, column=1)
calc_button.grid(row=0, column=2)
output_label.grid(row=1, column=0, columnspan=3)

def konvertuj():
    iznos=int(entry2.get())
    iznos=iznos*float(kurs)
    output_label.configure(text = 'Konvertovano u RSD: {:.1f}'.format(iznos))
    entry2.delete(0,END)

message_label = Label(text='Unesite vrednost u euro',font=('Verdana', 16))
output_label = Label(font=('Verdana', 16))
entry2 = Entry(font=('Verdana', 16), width=4)
calc_button = Button(text='Konvertuj', font=('Verdana', 16),command=konvertuj)
message_label.grid(row=2, column=0)
entry2.grid(row=2, column=1)
calc_button.grid(row=2, column=2)
output_label.grid(row=3, column=0, columnspan=3)

mainloop()


https://pypi.org/project/requests-xml/
https://api.kursna-lista.info/...a0ac413c7ee76/kursna_lista/xml


Prikačeni fajlovi
 
Odgovor na temu

nenad.bjelic
Nenad Bjelic

Član broj: 311866
Poruke: 2
92.244.132.*



Profil

icon Re: Kako da uradim ovo u Pythonu?27.05.2019. u 08:38 - pre 26 meseci
Hvala na pomoci.
 
Odgovor na temu

[es] :: Python :: Kako da uradim ovo u Pythonu?

[ Pregleda: 9718 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.