HTML Window self Property

AmitDiwan
Updated on 01-Oct-2019 11:48:09

97 Views

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

HTML Window top Property

AmitDiwan
Updated on 01-Oct-2019 11:45:43

206 Views

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

What is difference between raw_input() and input() functions in Python?

Manogna
Updated on 01-Oct-2019 11:42:24

221 Views

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

HTML Window resizeTo() Method

AmitDiwan
Updated on 01-Oct-2019 11:41:39

267 Views

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

How to open a file in read and write mode with Python?

Manogna
Updated on 01-Oct-2019 11:39:18

2K+ Views

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. 

How to open a binary file in read and write mode with Python?

Manogna
Updated on 01-Oct-2019 11:38:47

2K+ Views

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. 

HTML Window resizeBy() Method

AmitDiwan
Updated on 01-Oct-2019 11:38:14

54 Views

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

How to generate XML documents with namespaces in Python?

Rajendra Dharmkar
Updated on 01-Oct-2019 11:36:28

1K+ Views

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,

How to print to the Screen using Python?

Rajendra Dharmkar
Updated on 01-Oct-2019 11:34:57

659 Views

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

HTML Window moveTo() Method

AmitDiwan
Updated on 01-Oct-2019 11:34:54

144 Views

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

Advertisements