This sample is for error handling for subprocess.Popen. It confirms whether the execution file is existing. If the execution file is also not in the path, the error message is shown.
import subprocess res = subprocess.Popen( "application", # <- Execution file stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True ).communicate() if len(res[1]) == 0: print("ok: Application is existing.") else: print("Error: Application is not found.")
This sample is for using constructor between classes at Python.
Sample : class test1: def __init__(self): self.msg = "sample text" class test2: def __init__(self): self.msg = test1().msg print(test2().msg) >>> sample text
When a string without no strings is split by strings.Split(), the created slice is the same to the slice created by make(). The length of the slice doesn’t become zero.
Sample script : package main import ( "fmt" "strings" ) func main() { sample1a := strings.Split("", " ") fmt.Printf("%v, %v, '%v', %v, %+q\n", sample1a, len(sample1a), sample1a[0], len(sample1a[0]), sample1a[0]) sample1b := make([]string, 1) fmt.Printf("%v, %v, '%v', %v, %+q\n", sample1b, len(sample1b), sample1b[0], len(sample1b[0]), sample1b[0]) var sample2a []string fmt.
Description There are a limit executing time for Google Apps Script (GAS). It’s 6 minutes. So users have to pay attention to the process cost of the script. GAS can use JavaScript 1.7. This means to be able to be used comprehension for GAS.
In this report, the process cost for the comprehension has been investigated. The normal for loop was used as the competitor. As a result, it was found that the comprehension can be used one of methods for reducing the process cost.
This sample script is for embedding animation GIF in a cell using custom function on Spreadsheet.
I think that this method is one of various ideas.
Problem There are some limitations.
Images of jpeg and png can be embedded in a cell using =IMAGE(). But when animation GIF is embedded using it, GIF is not played. insertImage() can insert the animation GIF to sheet. But it is not imported to one cell.