Jump to content

Search the Community

Showing results for tags 'python'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 20 results

  1. Hello everyone, I want to print a web page with all things inside but I have a big issue. I loaded the web page converted in pdf and when I print the tables or pictures are split int half and on two pages. I Want to define in my code some sections to keep the tables or pictures on the same pages when I print. How can I do that ?
  2. I took a Python coding course in college. Basic level, it taught me how to code short, basic programs. This was six months ago. I recently tried to pick coding back up, and decided my first project; a dice game I had an idea for a while back, as a computer program. Problem: I've apparently forgotten how to do just about everything, because I can't even figure out why Pyzo (my program of choice for writing in Python) is throwing an error. All I want to do on the line in question is set a variable to 1. That's all. I've tried changing the variable name, tried putting it in all forms of quotation marks that I could think of. I even tried double equal signs. But: "dice1 = 1" is absolutely against the law, and I can not understand why. I've tried google search. I've tried Youtube for basic learning videos on Python. I tried everywhere I could think of on w3schools. I even tried StackOverflow, but they're very professional, like actual software developers, and that... intimidates me. I'm simply trying to pick this back up as a hobby.
  3. Hi! Can someone suggest how to continue learning python, once finished W3Sc. tutorial? THANX!
  4. @w3school info I'm a Revit and Dynamo user. I'd like to learn Python and get the Certificate. My company wants to know how much time is all the studying, modules, and tests in order to go through everything you have and get this certificate?I need total time investment ranges and broken down by the sections (ex. 1 lesson section stopping points).
  5. HI, I'm using RPC.Query to send a string from js to py. At py receptor this scrash using json.loads(..) de args. The messages error is: "" ... JSONDecoderError(\"Expecting value\", s, err.value) from None\njson.decoder.JSONDecodeEror: Expecting value: line 1 colum1 (char 0)\n", "message": "Expecting value: line 1, column 1 (char 0)"], "Exception_type":"internal_error"}}" "" I do an console.log(..) beford RPC instruction and the string value is ok. That is the code: FROM JS: .... // *JCM* var strcontenido = ''; var LF = '\n'; var orderi = JSON.parse(JSON.stringify(order)); var orderf = JSON.parse(JSON.stringify(order_flushed)); strcontenido ="80#DOCUMENTO DE PRUEBA +LF80_is*YO MISMO+LF80_ir*22157456+LF80_i03Dirección: Calle, 12345678 Ciudad, Venezuela+LF80_i04Teléfono: +584161236548+LF80_i05Referencia: 00001-317-0204+LF80_i06Mesa: M5, Comensales: 1+LF80_@*****Gracias por su compra*****+LF80_#000000010000001000Golosinas+LF101" strcontenido= strcontenido.split(":").join("?"); // Replace ":" with "?" to send to py strcontenido= strcontenido.split(",").join("-"); // Replace "," with "-" to send to py console.log(strcontenido); // This show ok errTxt = self._crear_factura( true, strcontenido); var transfer = self._flush_orders([order_flushed], {timeout:30000, to_invoice:true}); // *JCM* // ...do some... }); return done; }); return invoiced; }, // Envia comandos al programa en python- Send command to py _crear_factura: function(imprime, strcontenido) { var self = this; var ejecuted = true; strcontenido = '{"F": "\'' +strcontenido + '\'"}' // Converting string to json inserting {"id": '...string...'} format var args = JSON.parse(strcontenido); console.log('ARGS=>>'+args); // This show text ok >> 80#DOCUMENTO DE PRUEBA +LF80_is*YO MISMO+LF80_ir*22157456+LF80_i03Dirección? Calle- 12345678 Ciudad- Venezuela+LF80_i04Teléfono? +584161236548+LF80_i05Referencia? 00001-317-0204+LF80_i06Mesa? M5- Comensales? 1+LF80_@*****Gracias por su compra*****+LF80_#000000010000001000Propinas+LF101 if (imprime) { return rpc.query({ model: 'pos.order', method: 'print_ticket', args: args, }).fail(function(error, event){ ejecuted = false; }); console.log('_crear_factura (\n' + strcontenido +'\n): Ejecutada...!!!'); } else { console.log('_crear_factura (\n' + strcontenido +'\n): NO EJECUTADA...!!!'); } return ejecuted; }, ... FROM py: @api.model def print_ticket(self, strcontenido): #contenido = strcontenido.get('F') // Error: strcontenido d'nt have get method contenido = json.loads(strcontenido) // Error: previus commented f=open('c:/IntTFHKA/invoiced1.txt','w') #if strcontenido.get('F'): // Error: strcont.... # contenido = strcontenido['strcontenido'] errVal=f.write(contenido["F"]) // Never cross at this... #else: # errVal=f.write('***** GENERAR LA FACTURA*****\n\n') #for data in strcontenido: errVal=f.write(data) errVal=f.write('\n\n*****FIN DEL ARCHIVO******\\nn') errVal = f.close() return True So, I had proved some method without result.... ¿Do you have any idea to resolv...??
  6. Sir, I wrote the same code on Python and C. But the same code give two different result...my C code is... for (i=0;i<10;i++) continue; printf ("%d",i); and the my python code is... for i in range (0,10): continue print (i) The c code give 10 and python give 9 as result. So, what is loop execution process...what is the difference between loop execution process between Python and C?
  7. Sir, can I declare a Function with its return type and parameter's type on Python like C Language? void main() { void sum(int,int); /*function declaration*/ sum(5,5); } void sum(int x,int y)/*function defination*/ { /*function body*/ int result; result=x+y; printf ("The Sum is %d",result); } Can i do this same code on python? Python support Function Declaration? If yes, then how i declare a function on python
  8. Hi! First of all, I have very little experience with xml and I just learned yesterday about RSS feeds, so please simplify your answers if you are willing to help me. I did only read that rss uses the xml format, and apologise if I've posted this in the wrong place. I am trying to recreate an actual earth environment by using a raspberry pi that reads a RSS feed from a forecast site, which again is hooked up to an Arduino. The feed I am using is from bbc weather: https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/2525068 How can I pull certain values (temp, humidity, sunrise, and sundown) from the feed that can be stored as variables in a python code? Are there better ways of getting these values than using rss? I am not asking for help creating the code, I just wonder what options I have to research and learn to make this work. I apreciate any ideas or suggestions. This is only for private use and does not need to be the best or most complex solution, only a working one as I have to learn python as well. I do have experience with c# in case there are solutions more suited using that.
  9. Since you've added the new Python tutorial , are you planning to add a tutorial for Django framework?
  10. Raj Midha

    Python Project

    Hello folks. I am currently learning Python programming. I have created a fill in the blanks quiz game. In this game, the user has to select a level hard, medium, easy. On the basis of teh level selected, the respective question and its answers are passed as parameters into the function, question validation, this function takes user input and sees whether is matches the question and answer input. If it does, then the answer is passed onto the function, traverse. At traverse, the blanks are filled in and the sentence is returned with missing blank filled in. This seems to work well upto filling in the fourth blank. At this stage if I get the answer wrong on the first attempt and I later answer correctly, it then prompts me to fill in the 4th again. Its acting like an infinite loop. I cant for the life of me seem to solve this!!!! The problem lies here: time.sleep(2) print "wrong answer you have", tries, " attempts left" while tries>0: print "Fill in ",blanks[index], " please" response = raw_input() response = response.upper() if response == answers[index]: time.sleep(2) print "congratulations!!! " traverse(question, answers, index) else: tries = tries - 1 print "wrong answer you have", tries, "attempts left" print "Arividechi" exit() codeaquiz.py
  11. for n in range(2, 10): for x in range(2, n): if n % x == 0: print(n, 'equals', x, '*', n//x) break else: print(n, 'is a prime number') There are two issues here: 1. TabError: Incosistent use of tabs and spaces in indentation 2. More importantly I don't understand the logic behind this code that leads to this output:
  12. Hi, I'm looking at this piece of code: words = ['cat', 'window', 'defenestrate'] for w in words[:]: if len(w) > 6: words.insert(0, w) words ['defenestrate', 'cat', 'window', 'defenestrate'] If I understand well it should make copy of the list and add 'defenestrate' into list but I receive a message "tuple object has no attribute instert". This code is a part of a tutorial I'm following and not sure why it doesn't work.
  13. So this generates 3 arrays with 5 numbers in each one. How would I go about checking each array to see if there are any duplicate numbers in an array?
  14. Ok, so I know python specifically isn't taught onw3schools, but maybe somebody knows a little about it. I am trying to use raw input instead of prompts, but it isnt working, can anyone tell me why this won't work? $('#before').click(function(){ $(".body").empty(); hello = raw_input("Hello: "); }); "Hello: " never shows up on the screen. Please help
  15. Hi All,I'm developing a basic website and have a question. Hope it's not too much basic. I'm new in web stuff.I have the following code: $.ajax({url: '/blabla/yadayada'type: "get",success:function(data, testStatus, jqXHR){.........},error: function(jqXHR, testStatus, errorThrown){alert('error')}}); In addition, i have the following Python code: class AfCont(object):def __init__(self, target, context):self.target_server = targetself.context = contextself.baseContext = "/MyApp%s" % ( ("-" + self.context) if self.context else "")print "Starting %s with server: %s " % (self, self.target_server)def general_url(self, url_sfx):headers = {"Accept": "application/json"}params = Nonethe_url = "%s/%s" % (self.baseContext, url_sfx)print "%s %s %s " % (self, self.target_server, the_url)conn = httplib.HTTPConnection(self.target_server, "8080")conn.request("GET", the_url, params, headers)response = conn.getresponse()theResp = response.read()return theResp@cherrypy.exposedef bla_yada(self):htmlText = self.general_url("blabla/yadayada")return htmlText As you can see in the Ajax code, my URL is /blabla/yadayada. However, i need to send GET requests to /blabla/yadayada/number. I want to control the number part with a parameter. For example: number = 150 -- > `/blabla/yadayada/150`number = 9595-- > `/blabla/yadayada/9595` Can someone help me with that? Hope i was clear enough.
  16. I am using "Python-3.4.1 32 bit" on "Windows 7 64 bit" machine with "Selenium" using "Firefox 33". I am trying to automate downloading a "CSV" file from a secured website after furnishing the necessary credentials. I have written the required code to navigate to the correct element to initiate the download of the file but I am stuck when Firefox gives the download box (Dialog box title: Opening export.csv, "Open with" and "Save File" options as radio buttons with "OK" and "Cancel" as buttons). I want the file to be downloaded automatically and for that I have tried the following codes without success: from selenium import webdriverfp = webdriver.FirefoxProfile()fp.set_preference("browser.download.manager.showWhenStarting",False)fp.set_preference("browser.download.folderList",2)fp.set_preference("browser.download.dir", "C:UsersarunDownloads")fp.set_preference("browser.download.downloadDir", "C:UsersarunDownloads")fp.set_preference("browser.download.defaultFolder", "C:UsersarunDownloads")fp.set_preference('browser.helperApps.neverAsk.saveToDisk',"text/csv")driver = webdriver.Firefox(fp)driver.get("http://website-url.com") and then click on the button to start the download. But, it still shows the dialog box. I even tried handling it as an alert and tried alert = driver.switch_to_alert()alert.accept() but this always gave an exception of alert not found which led me to the conclusion that it might not be a JavaScript functionality after all but rather a web element. I am giving sufficient delay for the alert box to appear before I try to interact with it using the "alert" object code shown above.What do I do to get this downloaded automatically without the dialog box interaction (the way it's handled in Google Chrome browsers)I think that the server is not assigning the correct MIME type for the file that is being downloaded? The file I am downloading is of type: "text/csv" and in Firefox when the dialog box appears, "Do this automatically for files like this from now on" check box is greyed out.Thanks for your help and timeCheers!
  17. Dear Experts,I'm trying to parse an odd XML file that looks like this:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>Major Version</key><integer>1</integer><key>Minor Version</key><integer>1</integer><key>Application Version</key><string>9.2.1</string><key>Features</key><integer>5</integer><key>Show Content Ratings</key><true/><key>Library Persistent ID</key><string>9210E514389C76D3</string><key>Tracks</key><dict><key>732</key><dict><key>Track ID</key><integer>732</integer><key>Name</key><string>Tears All Over Town</string><key>Artist</key><string>A Girl Called Eddy</string><key>Album Artist</key><string>A Girl Called Eddy</string>...</dict><key>760</key><dict><key>Track ID</key><integer>760</integer><key>Name</key><string>The Nightingale</string><key>Artist</key><string>Angelo Badalamenti</string><key>Album</key><string>Twin Peaks</string><key>Genre</key><string>Soundtrack</string><key>Kind</key><string>MPEG audio file</string><key>Size</key><integer>7109800</integer><key>Total Time</key><integer>296150</integer><key>Disc Number</key><integer>1</integer><key>Disc Count</key><integer>1</integer><key>Track Number</key><integer>4</integer><key>Track Count</key><integer>11</integer><key>Year</key><integer>1990</integer><key>Date Modified</key><date>2006-01-04T06:51:56Z</date><key>Date Added</key><date>2009-04-02T02:04:11Z</date><key>Bit Rate</key><integer>192</integer><key>Sample Rate</key><integer>44100</integer><key>Play Count</key><integer>4</integer><key>Play Date</key><integer>3493240930</integer><key>Play Date UTC</key><date>2014-09-11T05:42:10Z</date><key>Sort Name</key><string>Nightingale</string><key>Persistent ID</key><string>9B002DC50111B620</string><key>Track Type</key><string>File</string><key>File Folder Count</key><integer>4</integer><key>Library Folder Count</key><integer>1</integer></dict><key>762</key>...Every field in the Itunes format has <key> for the fieldname, and the <datatype> surrounding the value.This looks a lot different from the xml format that I saw in this tutorial.http://www.stat.purdue.edu/~mdw/490M/STAT490Mday29.txt<CD><TITLE>Picture book</TITLE><ARTIST>Simply Red</ARTIST><COUNTRY>EU</COUNTRY><COMPANY>Elektra</COMPANY><PRICE>7.20</PRICE><YEAR>1985</YEAR></CD>First I experimented using grep on cygwin. But I don't know how to get a specific set of three lines out of the grouping with grep.With R, I was trying to parse the file, until I looked and saw that the format was different from all the examples.This post made it look easy:How can I export my iTunes library information to a spreadsheet?https://www.quora.com/How-can-I-export-my-iTunes-library-information-to-a-spreadsheetBut it completely failed. The xml doc got imported into Open Office as a document. Not a spreadsheet.For each CD, I want to extract the Artist, Album, and Composer (if it's there)Questions:Is there a name for this type of XML file?What would be the best tool and way to parse the info from the file?grep on cygwinRPythonJavaXQuerysomething else???Thanks a lot!
  18. I am trying to learn any programming language and I have looked into several sites including Oracle and I must say everything I've tried to learn hasn't stayed in well. I personally love the layout and the design as well as the ability to try it yourself on W3Schools' site. I Understand that W3Schools was made to teach everything you need to know to create a webpage, or to be used as a reference to commands in a language used in making a webpage, but I and many others would greatly benefit if W3Schools could adopt a programming section. I am starting to learn Java and as for right now I only request Java, But I would like to see all commonly used programming language. I used W3Schools to learn HTML, CSS, and a little bit of JavaScript, It took me a little under 7 hours to learn a large portion of HMTL and CSS. I just love W3Schools' Website and Teaching ways. I would love to learn every language possible here, I find this the best way to learn Computer languages.
  19. Hi! I am a *very* green amateur on web programming so maybe the question is kind of heretical.So is it possible (or reasonable) to use python instead of java for programming a web page?(Why not?) Thanks
  20. az1987

    Advice Need

    Hey all,I need some advice.I'm currently in my final year at uni, and my final year project looks interesting too me.Anyways in a nut shell i have to connect a radio receiver to a web server. And then allow the client to scan frequencies or choose a frequence on a web page.Also i have to have create a spectrum plot for each frequency strength.I was just wondering is this at all possible with python or is php or RoR better?
×
×
  • Create New...