该错误仅在我提交解决方案的竞争代码网站中明显可见-“ leetcode”,但是当我在在线文本编辑器或本地计算机上运行代码时,该错误并不普遍。
class Solution:
def __init__(self, x):
"""
:type x: str
:rtype: bool
"""
self.x = x
def convert_list(self):
# my_list = list(self.x)
self.my_list = list(self.x)
return self.my_list
def store_list(self):
my_list = list(self.x)
list_length = len(my_list)
new_new_list = []
for i in range(0,list_length):
new_list = my_list.pop()
new_new_list.append(new_list)
return new_new_list
def isPalindrome(self):
if self.convert_list() == self.store_list():
return 'true'.lower()
else:
return 'false'.lower()
X = Solution(input())
# print(X.store_list())
# print(X.convert_list())
print(X.isPalindrome())
答案 0 :(得分:0)
缩进了并且可以正常工作
exports.setGeo = functions.firestore
.document('establecimiento/{id}')
.onCreate((snap, context) => {
const newData = snap.data();
if(newData.latitud == null || newData.longitud == null){
let address =`${newData.direccion},${newData.nombremunicipio},${newData.nombredepartamento}`
var options = {
provider: 'google',
language:'es',
// Optional depending on the providers
httpAdapter: 'https', // Default
apiKey: 'apikey', // for Mapquest, OpenCage, Google Premier
formatter: null // 'gpx', 'string', ...
};
var geocoder = NodeGeocoder(options);
geocoder.geocode({address: address, countryCode: 'CO'})
.then(function(res) {
//console.log("Resultado " , res);
newData['id'] = context.params.id
if(res != undefined && res != null && res.length > 0){
let item = res[0];
newData.latitud = item.latitude;
newData.longitud = item.longitude;
}
else{ //pone colombia por defecto
newData.latitud = -72.0000000;
newData.longitud = 4.0000000;
}
//fecha actual en Unixtime
let fechaRegistro = Number(Math.floor(new Date().getTime() / 1000).toString());
newData['fechaRegistro'] = fechaRegistro;
console.log(newData.fechaRegistro);
var docEstablecimiento = admin.firestore().collection('establecimiento').doc(context.params.id);
docEstablecimiento.update(newData).then(function(res) {
return true;
})
})
.catch(function(err) {
console.log("Error ",err);
});
}
});