- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
The HTML Window self property returns the current window of the browser.SyntaxFollowing is the syntax −window.selfLet us see an example of HTML Window self Property −Example Live Demo body { color: #000; height: 100vh; background-color: #8BC6EC; background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat; text-align: center; } .btn { background: #db133a; border: none; height: 2rem; border-radius: 2px; width: 30%; display: block; ... Read More
The HTML Window top property returns the topmost browser window of the current window.SyntaxFollowing is the syntax −window.topLet us see an example of HTML Window top Property −Example Live Demo body { color: #000; height: 100vh; background-color: #8BC6EC; background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat; text-align: center; } .btn { background: #db133a; border: none; height: 2rem; border-radius: 2px; width: 30%; display: block; ... Read More
The function raw_input() presents a prompt to the user (the optional arg of raw_input([arg])), gets input from the user and returns the data input by the user in a string. For example, name = raw_input("What isyour name? ") print "Hello, %s." %nameThis differs from input() in that the latter tries to interpret the input given by the user; it is usually best to avoid input() and to stick with raw_input() and custom parsing/conversion code. In Python 3, raw_input() was renamed to input() and can be directly used. For example, name = input("What is your name? ") print("Hello, %s." %name)Read More
The HTML Window resizeTo() method resize a window relative to its current size by the specified values.SyntaxFollowing is the syntax −window.resizeTo(w, h)Here w and h define the value of resizing the window width and height in pixels respectively.Let us see an example of HTML Window resizeTo() Method −Example Live Demo body { color: #000; height: 100vh; background-color: #8BC6EC; background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat; text-align: center; } .btn { background: #db133a; border: none; ... Read More
To open files in read/write mode, specify 'w+' as the mode. For example,f = open('my_file.txt', 'w+') file_content = f.read() f.write('Hello World') f.close() Above code opens my_file.txt in write mode, stores the file content in file_content variable and rewrites the file to contain "Hello World". You can also use r+ mode as it doesn't truncate the file.
To open binary files in binary read/write mode, specify 'w+b' as the mode(w=write, b=binary). For example,f = open('my_file.mp3', 'w+b') file_content = f.read() f.write(b'Hello') f.close()Above code opens my_file.mp3 in binary read/write mode, stores the file content in file_content variable and rewrites the file to contain "Hello" in binary. You can also use r+mode as it doesn't truncate the file.
The HTML Window resizeBy() method resize the window relative to its current size by the specified values.SyntaxFollowing is the syntax −window.resizeBy(w, h)Here, w and h define the value of resizing the window width and height in pixels respectively.Let us see an example of HTML Window resizeBy() Method −Example Live Demo body { color: #000; height: 100vh; background-color: #8BC6EC; background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat; text-align: center; } .btn { background: #db133a; border: none; ... Read More
Currently you cannot add namespaces to XML documents directly as it is not yet supported in the in built Python xml package. So you will need to add namespace as a normal attribute to the tag. For example,import xml.dom.minidom doc = xml.dom.minidom.Document() element = doc.createElementNS('http://hello.world/ns', 'ex:el') element.setAttribute("xmlns:ex", "http://hello.world/ns") doc.appendChild(element) print(doc.toprettyxml())This will give you the document,
The basic way to do output to screen is to use the print statement.>>> print 'Hello, world' Hello, worldTo print multiple things on the same line separated by spaces, use commas between them. For example:>>> print 'Hello, ', 'World' Hello, WorldWhile neither string contained a space, a space was added by the print statement because of the comma between the two objects. Arbitrary data types can also be printed using the same print statement, For example:>>> import os >>> print 1, 0xff, 0777, (1+5j), -0.999, map, sys 1 255 511 (1+5j) -0.999 Objects can be printed on the same line ... Read More
The HTML Window moveTo() method moves a window’s left and top edges to the specified coordinates.SyntaxFollowing is the syntax −window.moveTo(x, y)Here, x and y define the value of moving the window horizontally and vertically in pixels respectively.Let us see an example of HTML Window moveTo() Method −Example Live Demo body { color: #000; height: 100vh; background-color: #8BC6EC; background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat; text-align: center; } .btn { background: #db133a; border: none; ... Read More
To Continue Learning Please Login
Login with Google