我正在使用 prettier,并使用 firebase init 和 eslint 选项初始化了我的项目。但是当我保存文件时,prettier 扩展会在对象花括号中添加间距,如下所示:
export { basicHTTP } from './http';
Run Code Online (Sandbox Code Playgroud)
这是我的 .eslintrc.js 文件,它与 firebase init 一起提供:
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'google',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['tsconfig.json', 'tsconfig.dev.json'],
tsconfigRootDir: __dirname,
sourceType: 'module',
},
ignorePatterns: [
'/lib/**/*', // Ignore built files.
],
plugins: ['@typescript-eslint', 'import'],
rules: {
quotes: ['error'],
},
};
Run Code Online (Sandbox Code Playgroud) 我正在尝试以下内容
$x = "126·10?";
$array = str_split($x);
echo "x = " . $x . "<br>";
echo "Array length: " . count($array) . "<br>";
echo "Charset: " .mb_detect_encoding($x)."<br>";
foreach($array as $i)
echo $i . " ";
Run Code Online (Sandbox Code Playgroud)
作为输出:
x = 126·10?
Array length: 10
Charset: UTF-8
1 2 6 ? ? 1 0 ? ? ?
Run Code Online (Sandbox Code Playgroud)
我想要·和?数组中的1个字符,怎么能这样做?我想要达到的是迭代字符串的所有字符,所以任何其他解决方案也是受欢迎的.
我的目标是只从 python 异常处理程序中获得最小的输出(没有回溯)。在一个简单的 python 脚本中我可以使用:
sys.tracebacklimit=0
然而在笔记本电脑中,这似乎并没有按照我想要的方式工作,而且输出实际上更差(更长)。有什么办法可以快速解决这个问题吗?