;> S.substitute (x= ' ssssss ')' Ssssss.glorious ssssss! '>>>If the replacement word is part of a word, then the parameter name must be enclosed in parentheses.>>> from string import Template>>> s=template ("It ' s ${x}tastic!")>>> S.substitute (x= ' fan ')"It ' s fantastic!">>>4. String methodsFind can look up substrings in a longer string. It returns the leftmost index of the location where the substring is located. Returns 1 if it is not found.>>> ' with a
= ' 1.23E-10 '
>>> Float (text)
1.23e-10
String Code Conversion
A single character can also be converted to its corresponding ASCII code by passing it to the built-in Ord function, and the CHR function performs the opposite action:
Copy Code code as follows:
>>> Ord (' s ')
115
>>> chr (115)
' s '
String method
The string is much richer than the list method, because the string "inherits" from the string module in many ways, and this article only int
environment Configuration
3. Check the compiling environment
4. include necessary macros
5. Set the variables during compilation according to the Make Parameter
6. Include Android. mk to be compiled
7. Set the compilation system target: prerequisites to control the entire compilation process.
The following are some explanations:
With the analysis of the android compilation system architecture in the previous section, if you need to modify the android compilation system, you can not blindly find
Creating a Service:Before actual create a angular service, first create a constructor in Javascript: // constructor Function function Droidservice () { this. Name = '; } function () { returnthis. name; };Then the we want to the use of this constutor function, you need to the new an instance: var New Droidservice (); = ' R2-d2 '; Console.log (Droid.speak ());What's need to understand, where do new opration, under the hook, Javascript does tow thing for you
This article illustrates the way of communication between ANGULARJS controllers. Share to everyone for your reference, specific as follows:
First, the use of the scope of the inheritance method
Because the inheritance of the scope is based on JS prototype inheritance method, so there are two situations where, when the value above the scope is the base type, modifying the value above the parent scope affects the child scope, whereas modifying the child scope only affects the value of the child
Currently, the JS framework and some development kits and library classes are as follows: dojo, scriptaculous, prototype, Yui-Ext, jquery, mochikit, mootools, moo. FX
Dojo (JS library and UI component ):
Dojo is currently the most powerful j s framework. It defines itself on its own wiki. dojo is an open-source DHTML toolbox written in JavaScript. Dojo really wants to be a "unified" toolbox. It is not only browser-level, but also ambitious. Dojo inclu
The difference between an assembly is not only the Assembly name, but also the assembly version, the Assembly public key, and the Assembly culture. In this article, you can set the assembly version through the interface and encoding.
□Set the assembly version Through Visual Studio
→ Right-click the project, select "properties", and select "application"→ Click "assembly information", set as follows, and click OK→ Click assemblyinfo. Cs in the properties folder of the project. You can see that
content Block
7) AjaxTabs content script-this multi-functional AjaxTab tab content block, which allows you to display content in an external file in a div layer or the original HTML element.
Tab menu with closing capability
8) tabPanes-this is an XP-style tabs that allows you to load or close a tab in real time.
9)
Closeable
Tabs module-this can also be disabled, but no function can be enabled.
Definitely worth looking at some tab instance operations
10) fabtabulous-A simple tab created usi
Like the in operator, when the forin operator is used to traverse object attributes, the entire prototype chain is also traversed. Example 1:
// Poisoning Object.prototypeObject.prototype.bar = 1;var foo = {moo: 2};for(var i in foo) { console.log(i); // prints both bar and moo}
Here we should pay attention to two points. First, the for in loop will ignore the attribute set to false by enumerable. For exa
the data meet: l≤n≤100 l≤m,o≤100;The i00% data satisfies: 1≤n≤100 1≤m,o≤1000.Casually write write, unexpectedly past, and no special do not exist, I also bother to change ... I want to eat enough.#include using namespacestd;intBest =0, Moo =-1, N, M, O;intvi[101], wi[101], si[101];voidSlove (intIintJintWints) { if(I >=N) { if(S >Best ) {Moo=Best ; Best=s; }Else if(S >
First,FJ letter matrix (moocrypt)DescriptionFew people know that cows are interested in matrices, especially the alphabet matrix. Farmer John (FJ) 's cows create a new Alphabet matrix: Find the words. For example, there is now a matrix of letters, as follows:UsopenOomaboMoomxoPqmromAs cows, they are only interested in the word "MOO". We can find 6 "MOO" in this matrix (on the same row, in the same column
hasOwnProperty function to obtain the correct result.
Var foo = {hasOwnProperty: function () {return false ;}, bar: 'Here be dragons'}; foo. hasOwnProperty ('bar'); // always returns false // use the hasOwnProperty of the {} object and set it up and down to foo {}. hasOwnProperty. call (foo, 'bar'); // true
HasOwnProperty is the only available method to check whether a property exists on an object. At the same time, we recommend that you always use the hasOwnProperty method when traversing obje
, member inner class, local inner class, Anonymous inner class2. Any internal classes are compiled into a separate class file3. The biggest role: encapsulation4. Anonymous classes can encapsulate internal conceptsStatic Inner classDeclaring in a class with the static decorationStatic members of external classes can be accessed in static inner classesColumn: public class Foo () {External call:Static Class woo{}-----------foo.woo=new Foo.woo ();}The scope of the static inner class is the same as t
One, string formatting, put a string on the left side, and the right place the value you want to format.' hello,%s,%s enough for ya? '>>> values = ('World','hot') print format% for ya?' %s plus%s equals%s ' % (#) # If the tuple that needs to be converted exists as part of the transformation expression, enclose it in parentheses. '1 plus 2 equals 3'1. Simple conversion' Price of eggs: $%d ' %'price ofeggs: $42'2. Field width and accuracy from Import Pi ' %10.2f ' % pi # character
First example:
Poisoning Object.prototype
Object.prototype.bar = 1;
var foo = {Moo:2};
for (var i in foo) {
console.log (i);//Prints both bar and Moo
}
Here we pay attention to two points, one for the in loop ignores the enumerable set to false. For example, the length property of an array. Second, because for-in will traverse the entire prototype chain, it can affect performance when the pro
prototype object, let's take a look at the example:
Modify Object.prototype
Object.prototype.bar = 1;
var foo = {Moo:2};
for (var i in foo) {
console.log (i);//Output two properties: Bar and Moo
}
We can't change the behavior of the for in statement, so the only way to filter the results is to use the hasOwnProperty method, as follows:
The foo variable is for
(var i in foo) {
if (
C # Set the assembly version for assembly generation 08,
The difference between an assembly is not only the Assembly name, but also the assembly version, the Assembly public key, and the Assembly culture. In this article, you can set the assembly version through the interface and encoding.
□Set the assembly version Through Visual Studio
→ Right-click the project, select "properties", and select "application"→ Click "assembly information", set as follows, and click OK→ Click AssemblyInfo. cs
Example 1:
// Poisoning Object.prototypeObject.prototype.bar = 1;var foo = {moo: 2};for(var i in foo) { console.log(i); // prints both bar and moo}
Here we should pay attention to two points. First, the for in loop will ignore the attribute set to false by enumerable. For example, the length attribute of an array. Second, because for in will traverse the entire prototype chain, when the prototype chain is t
The following file structure is used to change models. py to a package.
Copy codeThe Code is as follows:Myapp_ Init _. pyScripts_ Init _. pyInitialize_db.pyModels_ Init _. pyMeta. pyFoo. pyMoo. pyThe above meta. py defines a other model file sharing Base and DBSession in the code.
Copy codeThe Code is as follows:Base = declarative_base ()DBSession = scoped_session (sessionmaker (extension = ZopeTransactionExtension ))
Foo. py and moo. py are specif
. innerHtml + = 'My number: '+ I;Console. log (I );}
The Code is as follows:
// Declare the variable in vitro. The variable is created only once.Var container = document. getElementById ('Container ');For (var I = 0, len = someArray. length; I Container. innerHtml + = 'My number: '+ I;Console. log (I );}
Use as short code as possible
If you can increase readability, it makes sense to use the short format of the Code. Below is an incomplete list:
The Code is as follows:
// The condition
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.