Difference Between str and repr in Python

Pythonic
Updated on 30-Jul-2019 22:30:21

258 Views

The built-in functions repr() and str() respectively call object.__repr__(self) and object.__str__(self) methods. First function computes official representation of the object, while second returns informal representation of the object. Result of both functions is same for integer object. >>> x = 1 >>> repr(x) '1' >>> str(x) '1' However, it is not the case for string object. >>> x = "Hello" >>> repr(x) "'Hello'" >>> str(x) 'Hello' Return value of repr() of a string object can be evaluated by eval() function and results in valid string object. However, result of str() can not be evaluated. ... Read More

Use Comments to Prevent JavaScript Execution

Ankitha Reddy
Updated on 30-Jul-2019 22:30:21

317 Views

If you want another code while working in the same code document, then use comments. Comment the previous code and add the alternative code to test it. After the testing completes, uncomment the previous code. In this way, you can test both the codes. While using comments follow the below rules to create valid comments − Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript. Any text between the characters /* and */ is treated as a comment. This may span multiple lines. JavaScript also recognizes the ... Read More

Initialize Blank Final Variable in Java

Amit Sharma
Updated on 30-Jul-2019 22:30:21

1K+ Views

Yes! You can initialize a blank final variable in constructor or instance initialization block.

Offset Outline and Draw Beyond Border Edge with JavaScript

Sai Subramanyam
Updated on 30-Jul-2019 22:30:21

228 Views

To offset an outline, use the outlineOffsetproperty. It allows you to draw the outline beyond the border edge. You can try to run the following code to offset an outline and draw it beyond the border edge with JavaScript. Example Live Demo #box { width: 450px; background-color: orange; ... Read More

Use Capturing Groups in Java Regex

Paul Richard
Updated on 30-Jul-2019 22:30:21

149 Views

https://www.tutorialspoint.com/javaregex/javaregex_capturing_groups.htm

Named Capturing Groups in Java Regex

Arushi
Updated on 30-Jul-2019 22:30:21

211 Views

Java Regex Capturing Groups

Query Clause Evaluation Order in SQL

Sai Subramanyam
Updated on 30-Jul-2019 22:30:21

516 Views

As we know that SELECT clause is used to show all the rows and columns hence SELECT clause is evaluated in the last by the database server.

MySQL LOCATE Function vs POSITION and INSTR Functions

Rama Giri
Updated on 30-Jul-2019 22:30:21

560 Views

As all of these functions are used to return the position of a substring within a string but LOCATE() function is a bit different from POSITION() and INSTR() function. In both POSITION() AND INSTR() functions, we cannot manage the starting position of search with the help of argument as position argument in LOCATE() function. All of these functions are having a difference in syntax also.

Regex Named Groups in Java

George John
Updated on 30-Jul-2019 22:30:21

315 Views

Java Regex Capturing Groups

Eliminate Changes in Current MySQL Transaction

Sai Subramanyam
Updated on 30-Jul-2019 22:30:21

149 Views

We can use ROLLBACK command to eliminate the changes, made in a current transaction, permanently from MySQL database. Suppose if we run some DML statements and it updates some data objects, then ROLLBACK command will eliminate these updates permanently from the database. Example Suppose we have the following data in table ‘marks’ and we applied the transaction and ROLLBACK command as follows − mysql> SELECT * FROM Marks; +------+---------+---------+-------+ | Id | Name | Subject | Marks | +------+---------+---------+-------+ | 1 | Aarav | Maths | ... Read More

Advertisements