This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
在Python的string前面加上‘r’, 是为了告诉编译器这个string是个raw string,不要转意backslash '\' 。 例如,\n 在raw string中,是两个字符,\和n, 而不会转意为换行符。由于正则表达式和 \ 会有冲突,因此,当一个字符串使用了正则表达式后,最好在前面加上'r'。 | |
———————————————— | |
版权声明:本文为CSDN博主「orzlzro」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 | |
原文链接:https://blog.csdn.net/orzlzro/article/details/6645909 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
now = datetime.datetime.now() | |
print(now.strftime('%Y-%m-%d-%H-%M-%S')) | |
print(now.strptime('09/19/18 13:55:26','%m/%d/%y %H:%M:%S')) | |
# strftime convert time to string format; strptime convert string to given format. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="about"> | |
<div class="player"> | |
<iframe width="100%" height="100%" | |
src="https://www.videoindexer.ai/embed/player/00000000-0000-0000-0000-000000000000/9a296c6ec3" frameborder="0" allowfullscreen></iframe> | |
</div> | |
<div class="analyzer"> | |
<iframe width="100%" height="780" | |
src="https://www.videoindexer.ai/embed/insights/00000000-0000-0000-0000-000000000000/9a296c6ec3/?widgets=people,keywords,annotations" frameborder="0" allowfullscreen></iframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleep(ms){ | |
return new Promise(function(resolve){ | |
setTimeout(function(){ | |
resolve('sleep for '+ ms + 'ms'); | |
}, ms); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
interface Shape{ | |
void draw(); | |
} | |
class Circle implements Shape{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
import java.util.Observable; | |
import java.util.Observer; | |
class ObservableObj extends Observable{ | |
private int watched; | |
ObservableObj (int watched){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const Promise = require('promise'); | |
const assert = require('assert'); | |
/* | |
var p1 = new Promise(function(reject, resolve){ | |
//let result= fs.readFileSync('./index.html'); | |
let result= fs.readFileSync('./main.html'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const async = require('async'); | |
var arr =[5,4,3,2,1]; | |
async.forEachOf(arr, (index,i, callback)=>{ | |
setTimeout(()=>{console.log(`Wait for ${index} seconds`); callback(null);}, index*1000); | |
//这里的关键在于callback必须是在循环的异步方法里面,否则是无法起作用的。 | |
}, function(err){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const thumb = require('node-thumbnail').thumb; | |
thumb({ | |
source: './img', //can be directory | |
destination: './pics', // can be directory | |
concurrency:4, | |
width: 50 | |
}, (files, err, stdout, stderr)=> console.log('all done!')); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.amazonaws.services.lambda.runtime.RequestHandler; | |
import com.amazonaws.services.lambda.runtime.Context; | |
public class EchoHello implements RequestHandler <Request, Response> { | |
public Response handleRequest(Request request, Context context) { | |
String greetingString = String.format("Hello %s %s.", request.firstName, request.lastName); | |
return new Response(greetingString); | |
} |
NewerOlder